Skip to main content

Full text of "Atari 130 XE Personal Computer Owner's Manual"

See other formats


AATARI 130XE 

PERSONAL COMPUTER 


OWNER’S MANUAL 








IMPORTANT INFORMATION 


Like any electrical appliance, this ATARI 130XE Computer uses and produces radio¬ 
frequency energy. If it is not installed and used according to the instructions in this 
guide, the equipment may cause interference with your radio or television reception. 

If you believe that this equipment is causing interference with your radio or television 
reception, try turning the equipment off and on. If the interference problem stops when 
the equipment is turned off, then the equipment is probably causing the interference. 
With the equipment turned on, you may be able to correct the problem by trying one or 
more of the following measures: 

• Reorient the radio or television antenna. 

• Reposition the equipment in relation to the radio or television set. 

• Move the equipment away from the radio or television. 

• Plug the equipment into a different wall outlet so that the equipment 
and the radio or television are on different branch circuits. 

If necessary, consult your ATARI Computer retailer or an experienced radio and 
television technician for additional suggestions. 

Another helpful resource is How to Identify and Resolve Radio-TV Interference 
Problems, a booklet prepared by the Federal Communications Commission. This booklet 
is available from the U.S. Government Printing Office, Washington, DC 20402, Stock No, 
004-000-00345-4. 


WARNING: This equipment has been certified to comply with the limits for a Class B 
computing device, pursuant to Subpart J of Part 15 of FCC Rules. These rules are 
designed to provide reasonable protection against such interference when the 
equipment is used in a residential setting. However, there is no guarantee that 
interference will not occur in a particular home or residence. Only peripherals (computer 
input/output devices, terminals, printers, etc.)-that have been certified to comply with 
the Class B limits may be attached to this computer. 

Operation of noncertified peripherals with this computer is likely to result in interference 
with radio and TV reception. 

Every effort has been made to ensure the accuracy of the product documentation in 
this manual. However, because we are constantly improving and updating our computer 
software and hardware, Atari Corp. is unable to guarantee the accuracy of printed 
material after the date of publication and disclaims liability for changes, errors, and 
omissions. 

ATARI, ATARI BASIC, 400, 800, 1010, 1050, 65XE, 130XE, 800XL, XE, XM301 
XMM801, XDM121, XTC201, and XTM201 are trademarks or registered trademarks of 
Atari Corp. 

No reproduction of this document or any portion of its contents is allowed without the 
specific written permission of Atari Corp., Sunnyvale, CA 94086. 

A ATARI* 

©1985 Atari Corp. All Rights Reserved. 






AATARI 130XE 

PERSONAL COMPUTER 








The Right Computer 
for the Task at Hand 



Welcome to the world of personal computing. Your new 
ATARI® 130XE™ is one of the most powerful and versatile small 
computers you can buy. 

The 130XE is the newest addition to the XE™ series of ATARI Com¬ 
puters. With 131,072 bytes of Random Access Memory, the 130XE has 
twice the memory of the ATARI 65XE™ or the 800XL™ Computer. And 
with twice as much memory, the 130XE has more computing power 
and more potential. Your word processing files can be longer, your 
data files larger, and the educational uses of your computer system 
more advanced. 

Along with the extra memory, the 130XE has a full-stroke keyboard, 
superior sound and graphics capabilities, thousands of available 
software programs, and an array of compatible hardware accessories. 
The ATARI 130XE is the perfect computer for business, educational, 
and entertainment purposes. And the new 130XE comes with built-in 
ATARI BASIC programming language, so you can immediately begin to 
write your own programs. 

This manual is arranged for easy access to the information you need, 
whether you are a beginning or an advanced computer user. Part 1 
shows you how to unpack and set up your ATARI 130XE Computer, 
check whether it’s functioning properly, use the keyboard, load 
software cartridges, and expand the system by adding peripheral 
devices. 

Part 2 is an introductory lesson in BASIC programming. Your ATARI 
130XE has many applications, and understanding its built-in language 
will make your computer more fun and more useful. 

If you already know how to program, you should look at Part 3 of the 
manual. A variety of sample programs and the reference materials to 
enhance your programming skills are provided. And the advanced 
programmer will find the needed information to access the full RAM 
potential of the 130XE. 

Once you have the ATARI 130XE set up and working, look at the 
Resources section of the manual. There are unlimited resources for 
the ATARI Computer owner—from books and programs to users 
groups and magazines. You’ll find a whole realm of new activities and 
uses for your ATARI Computer. 








Table of Contents 



PART 1: GETTING STARTED 


Meeting the ATARI 130XE . . 

Hooking It Up 
Checking It Out 

Understanding Your Keyboard . .... i 

Introducing ATARI Graphics 17 

Adding an International Character Set ... .19 

Exploring ATARI BASIC ... 21 

Using Software 23 

Expanding Your System 25 

PART 2: PROGRAMMING WITH ATARI BASIC . 27 

Editing with the ATARI 130XE Keyboard ....... 29 

Writing a Simple BASIC Program: 

NEW, LIST, PRINT, RUN ... 35 

Creating an Interactive Loop: 

GOTO, DIM, INPUT . 41 

Using Random Numbers and Mathematical Functions: 

RND, + 47 

Making Decisions and Solving Problems: 

IF-THEN, FOR-NEXT . 55 

Producing Sound and Graphics: 

SOUND, SETCOLOR, COLOR . . 65 

PART 3: APPENDICES . 77 

A. Sample Programs .79 

B. BASIC Reserved Words. . . . . .... 93 

C. ATASCI I Character Set .101 

D. Error Messages 111 

E. Troubleshooting .115 

F. Resources 117 

G. ATARI 130XE Specifications 119 

H. Accessing the Full RAM Potential of the 130XE 121 

I. Connector Pinout Specifications. 123 


INDEX 


. 127 


CM LO O) 00 

































Parti 

Getting Started 


1 








Meeting the ATAR1130 XE 



Keyboard 


Keyboard 

Full-stroke design with access to 62 keys including the Help key and 4 
special function- keys. 



♦ * 0 Peripheral Port 

Connects a Serial I/O cable to peripheral equipment, such as disk 
drives, program recorders, printers, and modems. 

2 





























































^ Cartridge Slot 

Allows the use of plug-in software cartridges for quick and easy 
program loading. 


Expansion Enhanced Cartridge Interface (ECI) 

Connects high-speed peripherals such as fast floppy disk drives, hard 
disk drives, and custom I/O devices. 

^ Monitor Jack 


Connects a monitor cable for use with either a monochrome or color 
monitor. 


i j 

(tjp TV Channel Select Switch 
Selects channel 2 or 3 for the clearest picture. 
Television Jack 

Provides a plug for the TV Video Cable. 


Power Adapter Plug 

Connects the computer to the AC power supply. 
10 On/Off Switch 

Turns the power to the computer on and off. 



Controller Ports 


^ Controller Ports 

Connects touch tablets, numeric keypads, joysticks, and paddle 
controllers. Use Port 1 if only one controller is used. 


3 
















4 






Hooking It Up 


When you unpack your ATARI 130XE, make sure you have the 
following items: 

• ATARI 130XE Computer 

• AC Power Supply 

• TV Switch Box 

• TV Video Cable 

• 130XE Owner’s Manual 

• Warranty/Registration Card 

If you are missing any of these items, contact your dealer. (Your 
warranty covers missing items.) Another good idea is to save the 
packing materials in case you want to transport the computer or send 
it in the mail. 

Setting up your ATARI Computer system is easy. All you need is a 
television set and a screwdriver. Your ATARI 130XE can be connected to 
an ordinary black-and-white or color television, or you can buy a computer 
monitor to use solely as a display screen. 

To connect the computer to a monitor, follow the installation 
instructions that come with the monitor. You will need a connecting 
cable (usually supplied with the monitor) to attach the monitor to the 
ATARI 130XE Monitor jack on the back of your computer. 

If you are going to use a television as a display screen, locate the TV 
Switch Box and the TV Video Cable. The Switch Box attaches directly to 
your television, but it will not interfere with normal television reception. 
With the sliding switch in the COMPUTER position, your television will 
display signals from your ATARI 130XE. In the TV position, signals 
come from your television antenna. 


INSTALLING THE TV SWITCH BOX 

How you install the Switch Box will depend on the kind of antenna 
connection that you have. There are two types of connections: a 
round, 75-OHM connection and a flat, 300-OHM twin-lead connection. 
Follow the steps below for either type of antenna connection: 

1 . Disconnect your present VHF antenna or your cable TV line from 
the terminals on the back of your television. If the antenna cable is the 
75 -OHM round variety with a screw-on connector, attach it to a 

5 








75-OHM to 300-OHM adapter and then attach the adapter to the screw 
terminals on the bottom of the TV Switch Box. (You can purchase the 
adapter at a video or television store.) 



-C3C£> 


Adapter 




If the antenna cable is a flat twin-lead 300-OHM cable, attach it to the 
screw terminals on the bottom of the TV Switch Box. 



9 


2. If your television has a threaded VHF connection, attach a threaded 
VHF adapter to the twin-lead cable labeled Connect to TV VHF at the 
side of the Switch Box and attach it to your television. (The adapter 
should be supplied with your television; if not, you can buy one at a 
video or television store.) 


COMPUTER 

COMPUTER 

r 

























If your television has two VHF screw terminals, attach the twin-lead 
cable labeled Connect to TV VHF at the side of the Switch Box directly 
to the VHF terminals on your television. 


J2— 

COMPUTER 


COMPUTER 




CONNECT 
TO TV 
VHF 


UHF 


<S> <S> 


VHF 

(SMS) 




Television 



TV 

CONNECT TO MITtNNt 

\ / 


Note: If the terminal connections on your television are different from 
those shown, refer to the television manual or contact a service center. 

3. Remove the cover from the adhesive square on the back of the 
Switch Box and secure the Switch Box to the back of the television. 


CONNECTING THE COMPUTER TO THE TV SWITCH BOX 

4. Plug one end of the TV Video Cable into the COMPUTER connection 
on the TV Switch Box and the other end into the Television jack on 
your computer. Move the sliding switch on the TV Switch Box to the 
COMPUTER position. 


TV Video Cable 



7 



























5. With the power switch on the computer in the off position, insert the 
round plug of the AC adapter into the Power jack on your computer. 
Plug the other end into an electrical outlet. 

6 . Turn on your television and select channel 2 or 3, whichever is 
weaker in your area. Set the Channel switch on the back of your com¬ 
puter to the same channel. Turn on the power switch of your com¬ 
puter. In a few seconds you will see the word READY. 



The Ready prompt tells you that ATARI BASIC is ready for your instruc¬ 
tions and that your computer is hooked up properly. If the Ready prompt 
does not show up on your screen, try adjusting your television picture 
controls. (For more information, see Appendix E: Troubleshooting.) 

When you leave your computer on for more than nine minutes without 
using the keyboard, the computer will start changing colors to protect 
the television from “color burn.’’ Whenever you turn your computer 
off, wait a moment before turning it on again. 


CARING FOR YOUR ATARI 130XE 

• Wipe off dust with a moist, lint-free cloth. 

• Do not use household solvents or cleansers on the computer. 

• Keep liquids away from the work area. 

• Avoid smoking near the computer. 

• Don't move the computer more than is necessary. 


8 

















Checking It Out 




When you turn on your ATARI 130XE, it automatically tests itself. But 
you can run three separate tests just to insure that your computer is 
working properly. Running all three tests after setting up your com¬ 
puter for the first time is recommended. To run the tests, turn the 
computer on while you are holding down the I Option | key. You may 
also get to the test program by typing BYE when ATARI BASIC gives 
the Ready prompt. (If you have a disk drive hooked up to your com¬ 
puter, make sure it is turned off when you run the Self Test.) 

A Self-Test menu will appear on the screen. Like a restaurant menu, 
this menu offers a choice of selections: MEMORY TEST, AUDIO¬ 
VISUAL TEST, KEYBOARD TEST, and ALL TESTS. Press I select I to 
choose a test, then press (start]. Press ITieipl at any time to return to 
the Self-Test menu. When you select ALL TESTS, the computer runs 
all three tests for you. The tests repeat until you press the I Help | key. 
Press I Reset I to stop the tests and return to ATARI BASIC. 



MEMORY 

AUDIO-VISUAL 
KEYBOARD 
ALL TESTS 



MEMORY TEST 

This test checks Read Only Memory (ROM) and Random Access 
Memory (RAM). ROM is noneraseable memory containing the com¬ 
puter’s operating system. RAM is the memory for the programs that 
you use or write yourself. 


9 



























The Memory Test works a little like a stoplight. Two bars appear on 
the screen when the ROM is tested. If the bars turn green, the ROM is 
okay, and you may proceed. Red means stop; the ROM is out of order, 
and you must contact your ATARI retailer. 



During the RAM test, 48 kilobytes(K) of RAM are tested. Each of the 
48 small squares represents one K of RAM. If a square turns white, 
then green, the corresponding section is good. If a square turns red, 
the RAM section is not working. 

Note: If you enter the test program from ATARI BASIC by typing BYE, 
you’ll get 40 small squares during the Memory Test, not 48. ATARI 
BASIC takes up the other 8K of RAM. 


AUDIO-VISUAL TEST 


The Audio-Visual Test checks the four programmable sound voices 
and the color and graphics capabilities. A musical staff and treble clef 
appear on the screen above the number of the .voice being tested. Six 
notes are played and displayed on your screen. The six notes repeat 
once for each of the four voices. 



If a voice number appears but you don’t hear music, that voice is not 
working properly. Make sure that the volume on your television is 
turned up. If you are using a monitor, make sure the audio cable on 
the monitor is firmly attached. 

The colors displayed on the screen should be consistent during each 
test. 


10 





















THE KEYBOARD TEST 


When you select this test, you work with two keyboards—the one 
under your fingertips and a test keyboard on the screen. When you 
press a key, a corresponding key on the screen flashes in inverse 
video (a blue character on a white background), and a note sounds. 
The space bar and special-function keys are already in inverse video, 
so pressing any of them changes the matching key on the screen to 
normal video. The I shut I and I control | keys flash only when they are 
pressed simultaneously with another key. 



%1234S67890<> IDE 


VT1 QWERTYUIOP- - d] 
a A 5 D F G H J K L ; + * 0 


Id IZH CVBNH 



Look at the keys on the top row of the test screen keyboard. Each key 
except the 4 numbered keys represents a key on your keyboard. 
Reading from left to right, the keys in the top row include I Reset 1 . 1 start I , 
I select I | Option I , four numbered keys, l Heipl . Inverse Video, and I Break I 

There are two keys that do not flash or sound and that terminate the 
test when they are pressed: I Help I returns you to the Self-Test menu; 

I Reset I returns you to BASIC. The I Break I key does not function in the 
Self Test and evokes no response when pressed. If any key, except 
the l Break l key, does not flash on the screen when you press a key, 
the key is not working. 

In addition to the optional Self Test, your ATARI 130XE automatically 
tests itself each time you turn the computer on. If the computer’s 
circuits fail the test, your screen will display the words MEMORY 
TEST, along with red and green squares and rectangles. As long as 
you experience trouble-free operation, running the Self Test every few 
months should be sufficient. 

LOADING SOFTWARE CARTRIDGES 

To load a software program that you have purchased, make sure that 
the computer is turned off, hold the cartridge so that the label is 
facing up, push the cartridge firmly into the Cartridge slot on the back 
of the computer, and turn on the computer. If you have already been 
using another software program, turn off the computer, remove the 
first cartridge, insert the new cartridge, wait several seconds, and turn 
on the computer again. (For more information about software 
cartridges, see Using Software.) 


11 




































If you don't want to use ATARI BASIC (the programming language that 
is built into your ATARI 130XE), you can temporarily disable the 
language in several ways: plug in a software cartridge; hold down the 
I Optionl key when you turn on the computer; type BYE to exit to the 
Self Test; or, if the computer is connected to a disk drive, type DOS to 
activate the Disk Operating System. (For more details, see Exploring 
ATARI BASIC.) 












Understanding Your Keyboard 



Although the ATARI 130XE keyboard looks and works much like a 
typewriter, some special keys allow you to reach into a bag of special 
editing tricks. Some of the keys, like I Shift I and I Control l . are used in 
combination with other keys. These double-key combinations provide 
extra commands and functions without-increasing the size of the 
keyboard. 



The following general descriptions explain the special keys and how 
they are used. Because the function of a key may change from one 
program to another, it is important to consult the manual that accom¬ 
panies each program you use. For a detailed description of how the 
keyboard functions with built-in ATARI BASIC, see the chapter Editing 
with the ATARI 130XE Keyboard in Part 2: Programming with ATARI 
BASIC. 


13 





























































Gives you instructions in some 
programs when you need help. 


Start 


Usually tells the computer to 
begin running a game or a pro¬ 
gram. Consult the software 
manual. 





Often used to select one of 
several applications within a 
program. Because its function 
varies, consult the software 
manual. 



Temporarily disables BASIC when 
pressed as the computer is turned 
on. In some programs, chooses 
among program variations. 


Pressing | Reset I produces the 
same effect as turning the com¬ 
puter off and on again—with two 
exceptions. First, in most pro¬ 
grams l Reset I will not erase the 
computer’s RAM memory, where¬ 
as turning the computer off and 
on will. And second, use of the 
I Reset I key will save wear and 
tear on the power supply and the 
on/off switch. 


Esc 


Varies from program to program 
but is often used to go (escape) 
from one menu to another. 


Delete 
Bk Sp 




In most programs, including 
ATARI BASIC, deletes (erases) 
the character to the left of the 
cursor and moves the cursor 
one space to the left. Does not 
close up the space caused by 
the deletion. 


K 

Break 


1 



Stops the computer in the middle 
of an activity and returns the pro¬ 
gram to the opening screen. 


i^—^ 

Usually interrupts whatever 
function the computer is doing. 
Refer to individual program in¬ 
structions. 


14 












































Control 


c- 

7 


Return 



t 


\ 


Tells the computer that you are 
done typing or editing a pro¬ 
gram line. Returns the cursor 
to the left margin. 


7 

i 


In most programming languages, 
stops and restarts a moving 
screen display when you want to 
view a listing. 



Shifts the computer between up¬ 
percase and lowercase character 
modes in ATARI BASIC and other 
programs. Sometimes used in 
conjunction with the I Shift I key to 
change modes. In ATARI BASIC, 
exits from the Control Lock 
(graphics character) mode. 



Turns the Inverse Video mode 
on and off. On ATARI* 400™ 
and ATARI® 800™ models, this 
key was referred to as the 
ATARI logo key [XI 





\- 7 

ll 

J 

2 

v J 

\ 

Q \ 


Sounds the buzzer. (The TV 
speaker must be turned up for 
the buzzer to be heard.) 


V 


Control 




A 

n 





Produces an end-of-file (EOF) 
response to a program that is 
reading input from the keyboard. 
(Used by more experienced pro¬ 
grammers.) 



Always used in conjunction with 
another key. Prints special gra¬ 
phics characters when used with 
the alphabet keys in ATARI BASIC. 


IT 


Control 


/ 


71 


K=^\ 

Insert 




—Si 


Inserts a space between char¬ 
acters in ATARI BASIC, although 
its use varies from program to 
program. 


15 









































































































Deletes the character under¬ 
neath the cursor and shifts the 
remaining characters on the 
line to close up the empty 
space. 



In conjunction with other keys, 9 

types uppercase characters 
without leaving the lowercase 
mode. 


Control 




o 


o 


When used with the I Control | key, 
the arrow keys move the cursor 
up, down, left, and right. 


Shift 


\L 


71 


Insert 

> 


Inserts a blank line in ATARI 
BASIC. 




v_ J 

K 

V \ 

Q \ 


0 - 


+ 



/ 

l i 


/ \ 




screen. The program statement 
remains in the computer’s memory. 


Control 


Caps 


71 


Shift 


Caps 




Locks the computer into the Con¬ 
trol mode. Used when entering a 
series of commands that require 
pressing the I Control 1 key, such as 
creating graphics characters in 
ATARI BASIC. 


Locks the computer into the up¬ 
percase mode for alphabet 
characters. You will still need to 
press I shift I to enter the upper¬ 
case mode on the numeric and 
symbol keys. 


Most keys on the 130XE will automatically repeat when they are held 
down for more than half a second. 


16 































































































































Introducing ATARI Graphics 


The ATARI 130XE keyboard has 29 built-in graphics characters. They 
can be used to brighten up a chart or to create a work of art. To 
display the graphics characters on your screen, press the | control I key 
and any of the keys shown below. If you intend to use several 
'characters, it may be more convenient to lock in the Control mode by 
pressing I Control I and I Caps I . Press I Caps I to exit from the Control 
Lock mode and return to alphabet characters. 



17 


































































18 







Adding an 

International Character Set 



Ordinarily when you type pages in a foreign language, you go back 
and laboriously add accent marks, cedillas, and other diacritical marks 
by hand. You are spared that trouble with the ATARI 130XE Computer, 
which has an international character set. 

International characters are available when you use ATARI BASIC. The 
diagram below shows the international characters that are associated 
with the letter keys. To activate the international characters, type the 
statement below and press the | Return | key: 

POKE 756^204 

Pressing I Control | and any of the keys shown below will produce an in¬ 
ternational character instead of a graphics character. To return to the 
graphics character mode and normal keyboard utilities, type the 
following line and press the I Return I key: 

POKE 756/224 



19 





















































































20 









Exploring ATARI BASIC 



Your ATARI 130XE Computer has built-in ATARI BASIC, a version of 
one of the most popular programming languages. BASIC (Beginner’s 
All-purpose Symbolic Instruction Code) was developed at Dartmouth 
College in the 1960s to teach computer programming to beginning col¬ 
lege students. Since then, it has become the most commonly used 
programming language for home computers. 

Although BASIC is a single language, each version of BASIC language 
is slightly different, and ATARI BASIC has some important and unique 
features. For instance, special words in ATARI BASIC make producing 
sounds and creating color graphics easy. Also, ATARI BASIC is 
specially designed for the beginning programmer. Unlike'many ver¬ 
sions of BASIC, ATARI BASIC will check each program line that you 
write and tell you if you have made an error in grammar or syntax. 

And, of course, when you learn to program with ATARI BASIC, learning 
other versions of BASIC will be easier. 

ATARI BASIC is immediately available when you turn on the computer. 
If you don’t want to use BASIC, hold down the | Option 1 key when you 
turn on the computer. Another way to exit from BASIC is to type BYE, 
which activates the Self Test, or DOS, which activates the Disk 
Operating System (when the computer is connected to a disk drive). 

The second part of this manual, Programming with ATARI BASIC, is a 
simple tutorial for the first-time BASIC programmer. Unlike most 
tutorials, which make you study the syntax of the language first, this 
approach lets you immediately begin to write programs and word 
games, solve mathematical problems, and make use of the ATARI 
130XE sound and graphics capabilities. When you complete this step- 
by-step lesson, you will understand much better the functions of the 
keys and the workings of the computer. The tutorial will help you get 
the most out of your new ATARI 130XE. 

If you already know how to program in BASIC, the appendices give 
you most of the reference tools you will need to work at your own 
speed. Appendix A: Sample Programs includes programs of varying 
levels of difficulty to give you some practice before you start writing 
your own programs with ATARI BASIC. Appendix B: BASIC Reserved 
Words offers a list of the commands used in ATARI BASIC and a brief 
description of what each one instructs the computer to do. For 
advanced-level programmers, Appendix C: ATASCII Character Set lists 


21 










the decimal and hexadecimal locations of characters in the ATASCI I 
code. Also, for programmers who want to explore the entire memory 
capabilities of the 130XE, Appendix H: Accessing the Full RAM Poten¬ 
tial of the 130XE gives the formula for POKEing a bank of memory. 
Whenever Error messages appear on the screen, you can refer to 
Appendix D: Error Messages to find out what went wrong. Check 
Appendix F: Resources for the names of other valuable sources of in¬ 
formation about ATARI BASIC. 


22 




Using Software 


Your ATARI 130XE and your television are the hardware components 
of your system. Software refers to the computer programs that tell 
your ATARI 130XE what to do and how to do it. Some software pro¬ 
grams are built into your computer, some you can buy, and some you 
can write yourself. 


BUILT-IN SOFTWARE 

Built-in software is permanently stored in the Read Only Memory 
(ROM) chip inside the computer. Your ATARI 130XE contains a ROM 
chip encoded with the ATARI BASIC programming language and the 
Operating System program. The Operating System in the ATARI 130XE 
contains programs that allow the keyboard, display screen, program 
recorder, and most ATARI printers to communicate with one another. 


COMMERCIAL SOFTWARE 

Commercial software programs are written by Atari Corp. and by 
professional programmers and are available from retail outlets. Video 
games, spreadsheet programs, word processing programs, and 
programmed math lessons are just a few of the many types of 
software available for business and educational applications, and for 
entertainment. 

The ATARI 130XE is completely compatible with the 65XE and the 
800XL Computers. You select whatever software program you want to 
use, as long as it is designed for use with any of these computers. 

Your ATARI 130XE is equipped to use software cartridges. If you want 
to use software in diskette or audiocassette form, you will need to pur¬ 
chase a disk drive or a program recorder. 


Note: Some software programs written by non-Atari software 
developers for the earlier ATARI® 400™/ 800™ models may not work 
with your ATARI 130XE. If you have a disk drive, this problem can be 
remedied with a Translator Disk. The disk is available from ATARI 
Customer Relations, Atari Corp., P.O. Box 61657, Sunnyvale, CA 
94088. Cost: $9.95 plus $2.50 for shipping. California residents add 6.5 
percent tax. 


23 







USER-WRITTEN SOFTWARE 


Once you learn a programming language, you can write your own pro¬ 
grams. The ATARI 130XE comes with the ATARI BASIC programming 
language already built into the computer. The tutorial in Part 2 of this 
manual teaches you how to use this language to write BASIC pro¬ 
grams. However, you can write programs with other computer 
languages, such as ATARI Logo, by inserting a cartridge containing 
the programming language of your choice. 

SAVING YOUR WORK 

If you write your own programs, you will probably want to store them 
so that you can use them again. And if you use your computer for 
word processing, you will probably want to save that work, too. Just 
turning off the computer will automatically erase your work from the 
computer’s memory, but connecting a disk drive or a program 
recorder to your computer enables you to store and retrieve your work 
later. The disk drive saves information on magnetic diskettes, and the 
program recorder uses ordinary blank audiocassettes. The instructions 
that come with the disk drive and the program recorder will tell you 
how to use these devices. (For more information, see Expanding Your 
System.) 

LOADING SOFTWARE CARTRIDGES 

Loading ready-to-use commercial software cartridges into the ATARI 
130XE is a simple operation. Software that comes in a cartridge is in¬ 
serted into the Cartridge slot at the back of the computer console. 

First make sure that the computer is turned off. Inserting or removing 
a cartridge while the computer is on can damage the computer and 
the cartridge. Hold the cartridge with the label facing upward. Insert 
the cartridge securely into the slot. Then turn the computer on. If you 
have just been using another cartridge, wait a moment between the 
time you insert the new cartridge and the time you turn the computer 
back on. 


24 









Expanding Your System 



Your ATARI 130XE Computer is the center of a powerful and versatile 
system. Whatever job you need to do or game you want to play, the 
130XE has a peripheral to help. The most popular peripherals are il¬ 
lustrated below. 


Program Recorder 



Printer 



Monitor/Television 



Computer 



Modem 

O 


Disk Drive 



TV OR MONITOR 

A TV or monitor is the display screen for your computer. Many people 
prefer to use a monitor because it provides a sharper picture and does 
not conflict with television usage. Either a color or monochromatic 
(black-and-white) monitor or television can be used. However, many 
software programs are designed to showcase the colorful graphics of 
the ATARI 130XE Computer. 

DISK DRIVE 

An ATARI 1050™ disk drive lets you store and retrieve programs and 
other information that you create on your computer. Also, because 
many programs are available in diskette form, the disk drive provides 
access to an extended library of ready-to-use programs in the areas of 
word processing, financial management, education, and entertainment. 

25 

































































PROGRAM RECORDER 


The ATARI 1010™ program recorder is an inexpensive storage device. 
Like a disk drive, it lets you save programs and other information. 
Although not as efficient as a disk drive for business and professional 
use, it does provide access to a library of ready-to-use educational 
and entertainment programs. 

PRINTER 

As an ATARI Computer owner, you have a variety of printers to choose 
from. The XTM201™ and XTC201™ are non-impact, dot-matrix printers 
available for your 130XE. Both printers can print graphics; the XTC201 
prints in color. To print out reports and letters, graphics, and your 
computer programs, you can use the XMM801™, a high-quality, 
inexpensive, dot-matrix printer. And for printing professional looking 
business letters, you can use the XDM121™, a letter-quality, daisy 
wheel printer. 

MODEM 

With the ATARI XM301™ modem, your computer, and a telephone line 
you have access to a wide world of electronic communications. If you 
and a friend have modems connected to your computers, you can 
send letters to each other. And if you are connected to some of many 
data base and information services that are available, you can take 
advantage of electronic mail services, news services, reference 
materials, and user groups. 

JOYSTICK 

Joysticks are popular tools for entertainment and educational pro¬ 
grams. Using a joystick, you can control your computer without 
touching the keyboard. 











Part 2 

Programming 



27 











28 







Editing with 

the ATARI 130XE Keyboard 


No matter how well you type on a typewriter, you will need to 
familiarize yourself with the special features of the ATARI 130XE 
keyboard before you begin editing with ATARI BASIC. 

AUTO REPEAT FUNCTION 

Begin by typing the letter A: 

a 

Continue to hold down the 3 key and watch the rows of A’s appear. 
When a line is filled, the cursor automatically drops down to the next 
row. There is no need to press I Return I . 

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 

You are using the built-in auto repeat function of the ATARI 130XE 
keyboard. Most of the keys, including the space bar, have auto repeat. 
Did you hear a buzzer when the A’s almost filled the third line? That 
warning buzzer—a built-in function of ATARI BASIC—indicates that 
the instruction line is getting too long. An instruction line can be no 
more than three lines long. 

ERROR MESSAGES 

Find the I Return 1 key and press it. You should see the word ERROR on 
the screen, followed by the three lines of A’s that you typed. Your 
computer is interacting with you now. It is telling you that it doesn’t 
understand what you are typing because the rows of A's aren’t part of 
the BASIC language. Clear your screen by pressing I Return I until the 
Error message no longer appears. To avoid getting Error messages 
while yo u are following the directions for editing, do not press the 
I Return | key until you are instructed to do so. 

UPPERCASE AND LOWERCASE 

To make lowercase A’s, press the I Caps I key once and hold down the 
5] key. You should see this: 

aaaaaaaa 


29 




















To return to uppercase letters, press the leaps] key and type more A’s. 
You should see this: 

aaaaaaa 

Try typing a word—a word beginning with A, such as ATARI. Type in 
the following words, switching between upper- and lowercase letters 
with the I Caps | key: 

ATARI 130XE atari 130xe 

The numbers appear the same whether you are typing capitals or 
lowercase letters. Unlike a typewriter, the computer has separate keys 
to control capitalizing and shifting. In both the lowercase and the 
uppercase modes, the symbol that appears is always the one shown 
on the bottom of a key. To get the symbol on the top half of a key, use 
the I Shift l key. There are two I Shift I keys on the keyboard. You can use 
either one. 

Using the I Caps | . 1 Shift l, and PD keys, try typing this: 

■ ! ! ATARI 130XE ! ! ! ! ! ! atari 130xe ! ■ I 

Experiment with different words, letters, and punctuation marks. 

GRAPHIC SYMBOLS 

Many of the keys have two or three symbols on them. Each letter key 
has a letter on the top side and a graphic symbol on the front side. 
Some of the other keys have three symbols or words, all on the top 
side. One function o f a key is activated by pressing the key only, 
another by pressing I Shift I and the key, and the third by pressing 
I Control | and the key. Graphic symbols are produced by pressing 
I Control I and the key. 

To type a graphic symbol (the symbol on the front side of a letter key), 
use the I Control I key on the left side of the keyboa rd. First press the 
I Control | key. While you are still holding down the I Control | key, press a 
graphic symbol key. Then release both keys. 


Hold down the I Control | key and try typing ATARI. You should see this: 
































Only five characters appear on the screen. If you use the I Control | key 
when you press a number key, no graphic symbols appear. 


Graphic symbols are most useful in making screen designs, borders, 
and simple artwork. You can lock the keyboard into graphic symbols 
by holding down I Control | and then pressing I Caps I . Pressing I Caps | just 
once will put you back into the lowercase mode. 

CURSOR CONTROL 

The | Control | key is used most frequently for directing the movement of 
the cursor. The cursor is the small white square that marks your place 
on the screen. Find the Up Arrow key[“j] next to the letter P. The 
arrow, like the I Control I key, is outlined in white. This white marking 
indicates that the arrow function is activated only by using the I Control I 
key. Press the I Control | key and then the Up Arrow key [?j] and watch 
the cursor move up to the top of the screen. When it reaches the top, 
the cursor returns to the bottom of the screen and starts moving up 
again. Now try out the other directional arrow keys: [T 7 ;, if 7 ], [°~ 7 |. 
Remember to use the I Control I key. ~ 

CLEARING THE SCREEN 

The I Control | key is frequently used in conjunction with the I Clear I key 
to erase everyt hing o n the screen. Press and hold the I Control I key, 
then press the 1 Clear | key. This action should clear your screen and 
return the cursor to the upper left-hand corner of the screen. Try it 
again. 

Now fill up the screen with more letters, numbers, words, and graphic 
symbols. This time use the I shift I key with the I Clear I key to clear the 
screen. Both I shift | | Clear | and I Control 11 Clear I empty the screen and 
return the cursor to the upper left-hand corner. 


INSERTING 

The I Control | key is used with the I insert | key to insert spaces in a line. 
To practice this function, type 

■ ! ■ ATARI 130KE ■ ■ ■ 

Position the cursor on top of the first letter A in ATARI. Holding down 
the [Control | key, press the I insert | key 11 times. You should see this: 

! ! ! ATARI 130KE ■ ! ! 


31 



















































Eleven blank spaces have been added in the middle of the line. This 
function is very useful for inserting words. Using the cursor control 
keys (the arrows), return to the space next to the third exclamation 
mark on the line. Press the space bar once and type THIS IS AN in the 
blank spaces as shown below: 

! ! ! THIS IS AN ATARI 130HE ■ ! ! 

To add blank lines, rather than individual blank spaces, hold down the 
I Shut | key, then press the I insert l key. A whole new blank line will 
appear on the screen. Insert a few more blank lines, but don’t insert 
so many that you have a blank screen. Keep the sentence on the 
screen so that you can proceed to the next exercise. 


DELETING 

Using the I Control I key with the I Delete Bk Sp] key makes deleting just 
as easy as inserting. Position the cursor on the T in the word THIS. 
Holding down the I control I key, press the I Delete Bk Sp] key 11 times. 
Your screen should look like this: 

! ! ! ATARI 130XE ! ! ! 

You now know how the i control I and I Delete Bk Sp I keys work. To 
discover what the I Delete Bk SpI key does w hen pressed by itself, posi¬ 
tion the cursor on the first A and press the I Delete Bk SpI key three 
times. Your screen should look like this: 

ATARI 130XE ! ! ! 

When used alone, the I Delete Bk SpI key moves the cursor to th e left, 
erasing as it goes, but it does not close up the space. Using the 1 Control | 
key with the I Delete Bk Sp I key erases the characters to the right and 
closes up the gap. 

The third function of the I Delete Bk SpI key requires t he use of th e I Shift J 
key. Pressing and holding I Shift 1 and then pressing | Delete Bk s ^j 
deletes an entire line and returns the cursor to the left margin. It does 
not matter where the cursor is positioned on the line when you press 
I Shift! I Delete Bk SpI : the entire line is erased from the screen. 


32 














































TABS 


On a blank screen move the cursor to the left margin and type an 
asterisk. Press the I Tab I key. Every time the cursor stops, type an 
asterisk. You should have six asterisks spaced across the screen as 
shown below: 

* * *■ * * * 


Press the iTabi key only and notice that it stops at the same preset 
tab marks every time. The first preset tab is five spaces from the left 
margin (a normal paragraph indention), and the following tabs are 
eight spaces apart. Position the cursor on top of the first asterisk and 
move it in three spaces. Press and hold I Shut | and then press ITabi to 
activate the 1 Set Tab | function. Move the cursor back to the left margin, 
then press the ITabi key. The cursor jumps to the newly set tab position. 

Continue to press the I Tab 1 key. It continues to go to all the preset tab 
positions, in addition to the new one. When the cursor jumps down to 
the next line, it ignores the new tab position. (But on all the following 
lines the cursor will go to all the tab positions—the new one and the 
preset ones.) Return the cursor to the first asterisk and press the 
ITabi key. The new tab mark is still there. 

Return the cursor to the left margin. Press ITabi to move it to the first 
tab mark (three spaces in). Use the I control I key with the ITabi key to 
activate the icir Tab I function. Press the ITabi key to get to the next 
tab position and clear that one also. Move the cursor back to the left 
margin of the same line and press the ITabi key only. The cursor 
should skip two tab positions. Continue pressing the [Tab key until the 
cursor drops to the next line, icir Tab I did not clear the second tab 
position on this line. (However, both tab positions have been cleared 
from all the following lines.) 

INVERSE VIDEO 

Type the word ATARI. Find the Inverse Video key H and press it just 
once. Type ATARI again. Press the Inverse Video key again and type 
ATARI again. Your screen should look like this: 

ATARI HHlH ATARI 

Inverse Video creates blue letters on a white background, the inverse 
of the normal screen colors. This function is very useful for 
highlighting letters in your programs. Just one touch of the Inverse 
Video key changes the way the letters are displayed. 


33 








































MISCELLANEOUS KEYS 

Another important key is the Escape key I Esc | . When you press it 
once, nothing happens. When you press it twice or more, this graphic 
appears on the screen: t • Press I Return | and try again. In later sec¬ 
tions you will need to use the I Esc | key. 

The I Break I key is in the upper right-hand corner. When you press this 
key, the cursor drops one line and moves to the left margin. In the 
chapter about looping, you will learn how to use the [BreakJ key. 

When you press the I Heipj , | start I I Select I . and I Option! keys, nothing 
happens. These keys are programmable and often have functions in 
software programs. 

After you press the I Reset I key, the screen will turn bl ank for a second 
or two, and the Ready prompt will appear. The 1 Reset I key restarts the 
system. You should use this key very sparingly because, in many pro¬ 
grams, the information that you are entering or have entered will be lost. 


34 


























Writing a 

Simple BASIC Program: 

new, list, print, run 


Once you know your way around the computer keyboard, it’s easy to 
write your first program. To begin, clear the screen and make sure the 
cursor is on the left-hand margin. 

NEW: CLEARING THE COMPUTER’S MEMORY 

Type in the word NEW, then press |Return| : 

NEM 

NEW tells the computer to get ready for a new set of instructions by 
erasing any old instructions that might be in the computer’s memory. 

LIST: CHECKING THE COMPUTER’S MEMORY 

To make sure nothing is in the computer’s memory, ask the computer 
to list any instructions that it might be storing. Type LIST on a line by 
itself and press I Returnl : 

LIST 

If you typed NEW correctly, nothing other than the Ready prompt ap¬ 
pears on your screen. Now you can begin a new program. Type in the 
first line of instruction to the computer. Type in the line exactly as it 
appears below and press I Return! after the last quotation mark: 

18 PRINT "I HEARD OF A POET NAMED SAM" 

All instruction lines in BASIC programs are numbered. When you type 
this one-line program, make sure that the 1 and the 0 in the number 
10 are numerals, not letters. If you used letters instead of numbers, 
you will get an Error message. 

A numbered instruction line in a program can be longer than one line 
on the screen. When the cursor runs out of space on one line, it 
automatically drops down to the next line. You should press [Returnl 
only at the end of an instruction line to tell the computer that you are 
done typing the instruction and that it should store the instruction in its 
memory. Nothing dramatic happens when you press I Returnl ; the 
cursor merely returns to the left margin so that you can begin another 
line in the program. 


35 


















RUN: EXECUTING INSTRUCTIONS 

To make the computer execute your program, you have to type RUN. 
The RUN command tells the computer to carry out its instructions. 

Type RUN and press fReturnl to see what happens: 

RUN 

I HEARD OF A POET NAMED SAM 

The computer’s first and only instruction, line 10, was to print the 
words inside the quotation marks. Clear the screen, type RUN again, 
and press iReturnl . The computer follows its instruction again and 
prints I HEARD OF A POET NAMED SAM. 

Even though the instruction is no longer on the screen, the computer 
remembers what to do. Your program is stored in RAM (Random 
Access Memory), the programmable section of the computer’s 
memory. When you type LIST, the computer shows on the screen all 
the instructions stored in the RAM portion of its memory. Type LIST. 
Your screen should look like this: 

LIST 

10 PRINT "I HEARD OF A POET NAMED SAM" 

If your screen looks different, you might have forgotten to press 
IReturnl at the end of each entry or to type LIST on a line by itself. 

Type in the line below, then give the RUN command: 

20 PRINT "I MET HIM ONE DAY, AND TO MY DISMAY, " 

RUN 

The words enclosed in the quotation marks in both lines of the pro¬ 
gram appear on the screen. Type LIST to see the instructions that the 
computer has stored in RAM. Both lines 10 and 20 appear. 

LINE NUMBERING: CREATING ORDER 

Each instruction line in a BASIC program must have a number in front 
of it. The numbers are called “line numbers.” The computer executes 
the instructions, beginning with the smallest number and continuing 
through the program until all the instructions have been carried out. 
The usual procedure is to number lines by tens so that enough 
numbers are available for inserting additional lines later, if desired. Try 
inserting a line now. Add line 15 (shown on the next page) and instruct 
the computer to run the program. Your screen should look like the 
following: 


36 













15 PRINT "WHOSE POEMS WERE THE TALK OF THE LAND . " 

RUN 

I HEARD OF A POET NAMED SAM 

WHOSE POEMS WERE THE TALK OF THE LAND. 

I MET HIM ONE DAY, AND TO MY DISMAY, 

The computer automatically inserted line 15 between lines 10 and 20. 
Write another line: 

30 PRINT "HIS BRAINS MERE SILICON-SAND . " 

RUN 

LIST 

The RUN and LIST commands cause all four lines of PRINT instruc¬ 
tions to appear on the screen. 

ERROR MESSAGE: COMPUTER TALK FOR 
“I DON’T UNDERSTAND” 

PRINT simply tells the computer to print whatever is inside quotation 
marks on the screen. The computer doesn’t care what words or symbols 
are inside the quotation marks; the words don’t need to be spelled cor¬ 
rectly or make sense. Try out the instructions below: 

48 PRINT "AYE SAY HYE; U SAY BI. " 

RUN 

Even when the quotation marks enclose a nonsense sentence containing 
misspelled words, the computer does what it is told to do. However, 
try misspelling PRINT as shown below and see what happens: 

50 PRIMT "I SAY HI; YOU SAY BYE. " 

The computer sends you an Error message. The computer checks up 
on only those instructions that are outside the quotation marks 
because those instructions are intended for the computer. Instructions 
that are inside the quotation marks are intended for you, so the com¬ 
puter copies them exactly. Move to a blank line but do not clear the 
screen. Run the program to see what happens. 

Error message 17 appears at line 50, the line in which you intentionally 
misspelled PRINT. Error message 17 is called the “syntax error." It 
indicates that the instructions were undecipherable to the computer. 
(For a complete listing of Error messages, see Appendix D.) 

There are several ways to correct an Error message. The easiest solu¬ 
tion is to move the cursor to the line that contains the typing error. 
Place the cursor on the offending M in PRIMT and change it to N. 

37 





Press iRetuml . (In this case, you can press iReturnl regardless of the 
cursor’s position on the line, even if it is in the middle of the word 
PRINT,) No new Error message appears this time. Clear the screen 
and run the program. The screen should not show any Error 
messages. 

Another way to correct an Error message is to erase the offending 
line, To practice this technique, type another line that has an inten¬ 
tional error. This time omit the quotation marks in the PRINT state¬ 
ment below, then run and list the program: 

68 PRINT I ONCE HAD A PROGRAM CALLED BOZON 

RUN 

LIST 

An Error message appears when you press IRetuml and when you try 
to run and list the program. To erase the offending line, simply type 
the line number and press IReturnl : 

60 

RUN 

LIST 

Now the program runs and lists without errors, although line 60 does 
not contain any instructions. The line I ONCE HAD A PROGRAM CALLED 
BOZON has been erased. Typing the line number and pressing IRetuml 
erases a line entirely from the computer’s memory. Type the line cor¬ 
rectly as shown below: 

60 PRINT "I ONCE HAD A PROGRAM CALLED BOZON" 

RUN 

PRINT: CREATING BLANK LINES 

Inserting a blank line after the poem would make the poem more 
readable. Type in the following instructions to create a blank line 
between lines 30 and 40: 

35 PRINT 

RUN 

LIST 

When nothing follows the PRINT command, the computer creates a 
blank line. Insert another blank line between lines 50 and 60. Use 55 
for the line number and type only the word PRINT after it. 


38 















? : ABBREVIATION FOR PRINT 


You can save time and effort by substituting a question mark (?) for 
PRINT. Try the next program line below: 

78 ? "THAT RAN FROM DUSK UNTIL DAMN. " 

RUN 

LIST 

The program runs the same with ? as with PRINT. The question mark 
is just a convenient shortcut. For clarity, all the following PRINT 
statements in this tutorial use the word PRINT, but you can substitute 
a question mark. 

LOGICAL LINE LENGTH 

Sometimes the quotation marks contain too many characters to fit on 
one or two lines. Make sure the sound is audible on your television or 
monitor before you type the following sample: 

80 PRINT "IT MOULDN'T RESPOND TO ESCAPE, BREAK.. CONTROL, 
OR LIST, AND IT MAS STILL RUNNING MHEN I TURNED OFF THE 
SNITCH." 

When the cursor reaches the third line, a buzzer sounds. The buzzer 
indicates when you are approaching the maximum length of an in¬ 
struction line. An instruction line can be no longer than three screen 
lines. This limit is called a “logical line.” (You may wish to turn down 
the volume now.) 

SCREEN DISPLAY 

Words are often broken in awkward places when the cursor reaches 
the end of a line on the screen. Also, the spacing between words 
when you type in the program lines is different from the word spacing 
when the computer runs out the program. To avoid both of these prob¬ 
lems, determine what you want each line to look like and type 
separate PRINT statements for each line. Retype the sentence in line 
80 so that it appears in a poem format: 

80 PRINT "IT MOULDN'T RESPOND" 

90 PRINT "TO ESCAPE, BREAK, CONTROL, OR LIST," 

100 PRINT "AND IT MAS STILL RUNNING" 

110 PRINT "MHEN I TURNED OFF THE SMITCH . " 

RUN 

LIST 


39 






PRINTING GRAPHIC SYMBOLS 


You can also use graphic symbols in PRINT statements to produce 
simple artwork. To set off the poem, type the lines below. Use | Control I 
in and .Control! HT to create the graphics: 

58 PRINT 
115 PRINT 

PRINT 11 IS ": CLEARING THE SCREEN 

You can make your program look even better by making sure the 
screen is clear when you start. Type a line number, PRINT, and the 
first quotation mark. Press the I Esc I key once lightly. Then press either 
the I shift I and I Clear I keys or the I Control I and I Clear I keys. A bent 
arrow appears on the screen. Type another quotation mark and press 
IRetumj . Then run and list the program: 

5 PRINT " IS" 

RUN 

LIST 

Control | 0: STOPPING THE SCREEN DISPLAY 

Now the program looks better, but it is too long for all the lines to 
appear together on the screen. When the computer lists the program, 
you can stop the lines as they move up and off the screen by pressing 
the |Control| and the □ keys. Type LIST. Use two fingers on your left 
hand to press the I Control I and j] keys and one finger on your right 
hand to press |Return| . | Control | [T both starts and stops the LIST 
function. 


40 































Creating an Interactive Loop: 


GOTO, DIM, INPUT 

Loops tell the computer to go back and repeat instructions in the 
program automatically. The GOTO command saves you the trouble of 
typing the same instruction lines over and over again. The DIM and 
INPUT commands allow you to interact with your computer on a 
question-and-answer basis. Putting these three commands together— 
GOTO, DIM, INPUT—lets you have an ongoing conversation with your 
computer. 

GOTO: A COMPUTER’S MAP 

The simplest computer loop is the GOTO loop. GOTO is always 
followed by a line number that tells the computer where to go on the 
next command. You need just two commands to create a loop. Type in 
the program below to produce an infinite loop: 

NEW 

lie PRINT "CONGRATULATIONS!" 

120 GOTO 110 
RUN 

To break this infinite loop, turn off the machine or use the FBreaH key. 
When you stop the loop with the FBreakl key, one of the following 
messages appears: 

STOPPED AT LINE 110 

or 

STOPPED AT LINE 120 

The computer is telling you where it was when it received the 
command to stop. 

Comma: A Tab Maker 

The GOTO loop puts out an endless amount of work with just two lines 
of instruction. To make the program fancier, list your program, position 
the cursor in the space next to the last quotation mark, insert a 
comma, and press 1 R eturnl . Run the program and watch the special 
effects: 

LIST 

lie PRINT "CONGRATULATIONS! ", 

120 GOTO 110 
RUN 


41 











The comma acts like a tab. Each time the computer moves down to 
the next line and prints CONGRATULATIONS!, it moves to the next tab 
position. The result is a barber-pole effect. Remember to break the 
loop with the I Break I key. 

Semicolon: Computer Glue 

A semicolon produces another kind of effect. List the program, change 
the comma in line 110 to a semicolon, press |Retum| , and run the 
program: 

LIST 

110 PRINT CONGRATULATIONS! 11 .: 

120 GOTO 110 
RUN 

The semicolon glues the PRINT statements together with no space in 
between. To put some space between the words, go back and edit line 
110 so that it looks like this: 

110 PRINT "CONGRATULATIONS! 

RUN 

Colon: A Separator 

The colon is a separator. It permits two instructions to be placed on 
one line. Change the semicolon in line 110 to a colon and add the 
PRINT statement below: 

lie PRINT "CONGRATULATIONS! 11 : PRINT "YOU JUST MON THE 
LOTTERY." 

RUN 

As you progress in your programming ability, conserving space in the 
computer’s memory becomes important. Consolidating commands on 
one line with a colon is one way to help save free bytes of RAM 
memory. (A byte is one character of information.) To see how much 
memory is conserved, type the following statement: 

PRINT FRE C05 

The computer will answer with a number. Reprogram line 110 so that 
the two PRINT statements take up two program lines: 

lie PRINT "CONGRATULATIONS!" 

115 PRINT "YOU JUST HON THE LOTTERY . " 

PRINT FRE CO) 


42 














Compare the two numbers of free bytes available. The second number 
is two or three less than the first. Because simplicity is more 
important to a beginning programmer than conservation of computer 
memory, the program lines in this section will usually contain only one 
statement per line. One exception will be a PRINT statement that 
inserts a blank line between segments of the program. Type in the 
new line below to see the effect: 

lie PRINT:PRINT "CONGRATULATIONS!" 

RUN 

DIM AND INPUT: DIMENSIONING AND INPUTTING 
STRING VARIABLES 

The computer must be programmed to respond to a question. You can 
use a PRINT command to ask a question and an INPUT command to 
enter a response into the computer. However, when you give the 
computer an answer, the computer must know where to put it. It 
places it in a spot called a "variable” in RAM memory. If the answer 
is composed of letters, numbers, or both, it is called a "string 
variable." Your ATARI 130XE Computer needs to know how much 
space you will need for an answer so that it can reserve space for it. 
This process is called “dimensioning the string variable." 

The DIM (dimensioning) command always accompanies the INPUT 
command for string variables because DIM determines the expected 
size of the answers. For variables, the size refers to the number of 
characters, including blanks, that are needed. You have to tell the 
computer the maximum number of spaces that the answer can 
occupy. 

Change the loop program to a program that asks a question and 
expects an answer. There is no need to rewrite the program; just write 
in the new lines—lines 10, 120, 130, and 140—as shown below. 
(Typing in the new line 120 automatically erases the old line 120.) 

18 DIM ANSWERS CIOOI 

110 PRINT: PRINT "CONGRATULATIONS!" 

115 PRINT "YOU JUST MON THE LOTTERY . " 

120 PRINT : PRINT "HOW DOES THAT MAKE YOU FEEL?" 

130 INPUT ANSWERS 

140 PRINT "I THOUGHT YOU WOULD SAY THAT. " 

RUN 


43 












Line 10 tells the computer to save enough space in its memory for an 
answer that is a maximum of 100 characters. The variable in this 
program has been named ANSWER. The variable is going to store 
letters and numbers, so it is a string variable. String variables are 
designated by a dollar sign after the last letter of the variable name. 

Line 130 allows you to enter an answer. When you run the program, 
the computer displays the question on the screen, and you then type 
in your answer. That answer is stored in the string variable called 
ANSWERS. If the DIM statement, line 10, was omitted, an Error 
message would occur, and the INPUT statement wouldn’t work. 

?: Courtesy of INPUT 

Run the program again. Two question marks will appear on the 
screen. The second question mark will be on the line next to the left 
margin. List your program and notice that you typed only one question 
mark in the program. The INPUT command always puts a question 
mark on the screen for you. Type the variation of line 120 below: 


Run the program and type in your response when the computer asks 
its question. Now only one question mark appears, and your answer 
immediately follows the question on the same line. Create some more 
dialogue by dimensioning more string variables and inserting more IN¬ 
PUT statements. The DIM statements should be at the beginning of 
the program: 

20 DIM DATES C25J 

140 PRINT : PRINT "HHEN MOULD YOU LIKE TO COME AND PICK UP 
YOUR PRIZE" j 
150 INPUT DATES 
RUN 

String Variables in PRINT Statements 

The computer program now asks two questions but doesn’t respond to 
your last answer. To get a response, you can place the string variable 
in the PRINT statement in the following way: 

160 PRINT "I * M SORRY, BUT OUR OFFICES ARE ALMAYS CLOSED 
ON "JDATES;" . TOO BAD! " 

The semicolon glues the string variable between two phrases in 
quotation marks. Run the program. If the words are not spaced 
correctly, compare your line to the line above. You probably left out a 


44 









space after the N of ON or forgot the period and the space before 
TOO BAD!. Those spaces are important. Practice with another string 
variable input: 

38 DIM HOMES tl) 

170 PRINT "BY THE MAY,. WHAT IS YOUR NAME" ; 

180 INPUT NAMES 

ISO PRINT "HELL.. " ; NAMES; " f I BET YOU MOULD LIKE TO KNOM 
HOH MUCH YOU HON . FIRST YOU HAVE TO ANSHER A QUESTION. " 

Run the program. Even though you typed in a full name, the computer 
printed only the first initial. That happened because the area 
dimensioned in RAM memory for the name was too small. Most 
people’s names are longer than one character. Change line 30 to a 
more reasonable number of spaces and run the program: 

30 DIM NAMES C25J 
RUN 

Inputting Numeric Variables 

So far you have been working with alphanumeric string variables— 
variables composed of letters, numbers, or both. For instance, the 
computer would accept the name R2-D2 or 007 as a string variable. 
Flowever, the number name would be used only as a name, not as a 
number in any math problems. Now try some numeric variables that 
can be used in mathematical calculations. Numeric variables do not 
need a DIM command or a dollar sign. Enter the following program 
lines: 

200 PRINT : PRINT "HOH OLD ARE YOU"; 

210 INPUT AGE 

220 PRIZE=AGE*1000 

230 PRINT : PRINT 11 YOU HAVE JUST HON $" ; PRIZE; " FROM THE 
LOTTERY. YOU CAN COLLECT DURING OFFICE HOURS. 11 

In this program, the age that you enter is stored in the numeric 
variable called AGE. Line 220 creates another variable called PRIZE. 
Line 220 allows the computer’s built-in calculator to calculate the 
prize money, which is $1000 multiplied by the age of the winner. (To 
the computer, * means multiply.) The program does the math for you 
and stores the answer in PRIZE. Line 230, which places the numeric 
value inside the PRINT statement in the same manner as string 
variables, tells you what the answer is. 


45 









INPUT LOOPS 


To repeat your conversation with the computer, add a loop command 
to the program again. A GOTO statement at the end will make the 
computer repeat the program from the beginning. For program 
readability, use a REM statement to show where the main 
conversation portion of the program begins. A REM (remark) statement 
functions like a label for the programmer. The computer does not 
carry out REM commands but only prints them when you list your 
program. 

100 REM *** CONVERSATION LOOP *** 

240 GOTO 100 

The computer must return to line 100, rather than line 10, because it 
cannot go back over the DIM statements for string variables. If it loops 
over the same DIM statements, you will receive an Error message. 


46 









Using Random Numbers 
and Mathematical Functions: 


RND, *,/ 



Initially computers were developed to process numbers quickly and easily. 
To take advantage of the computer’s ability to calculate a math answer 
in a few milliseconds, you must know how to speak to a computer. 


NUMBERS 

Type the statement below and press iReturni : 

PRINT 10 

The computer should print the number 10. Make sure you use the 
numerals 1 and 0, not letters. Practice printing the following numbers: 

PRINT 1000000000 
PRINT-100000000 

Use the minus sign (-) on the Up Arrow key jfj to indicate negative 
numbers. Do not use commas in numbers. Type the statements below 
to see what happens when commas are used: 

PRINT 9/876/543/210 
PRINT 9/ 876/ 543/ 210 

In both examples, the computer interprets the commas as separators 
in a series of numbers. It spaces the numbers out across the screen 
according to its preset tab positions. To the computer, the 9 is not 9 
billion, just the number 9 followed by a series of other numbers. 

SCIENTIFIC NOTATION 

The computer may not understand commas when it prints numbers, 
but it does understand exponents. Often it will automatically translate 
a large number into an exponential form. Try the numbers below: 

PRINT 33333333333 
PRINT 55555555555 
PRINT 11111111111 
PRINT-11111111111 
PRINT-98765432112 


47 













These numbers are large or small enough that the computer prefers to 
rewrite them in scientific notation. Familiarity with scientific notation is 
not essential for understanding the computer, or even this chapter. 

Scientific notation expresses a large number as a number between 0 
and 10 multiplied by a power of 10. An exponent specifies the power 
of 10. In the following example, E + 13 means that the exponent is 13 

2.5E + 13 = 2.5 X 10 13 = 25000000000008 

You can use exponents to talk to your computer. The caret on the 
Right Arrow key is the symbol for exponents. You must use the 
1 shift | key to print the caret. Try the following computations: 

PRINT 2 a 1 
PRINT 2 a 2 
PRINT 2 a 3 
PRINT 2 a 4 
PRINT 2 a 64 

The first notation is 2 to the first power; the second, 2 to the second 
power; and so on. The last notation is 2 to the sixty-fourth power, 
which is a large enough number that the computer needs to express 
it in scientific notation. 

Unless you are a physicist timing electrons in their orbits or an 
astronomer calculating the size of the universe, you will rarely need to 
use scientific notation. But if you ever do, the computer is capable of 
doing your calculations with even these often unwieldy numbers. 

THE COMPUTER AS A CALCULATOR 

The computer can perform the same fun ct ions as a calculator. Use 
the plus (+) sign on the Left Arrow key |c ? '] to type the statement 
below: 

PRINT 1 + 1 

When you press I Return 1 , the computer immediately gives you an 
answer, just like a calculator. Invent your own addition problems now. 
Make the numbers big or small, and try a long series of numbers to 
add up. Experiment with lots of variations. 

Use the minus sign (-) on the Up Arrow key “_] for subtraction prob¬ 
lems. Try the three versions of the same problem below: 

PRINT 4-1 
PRINT 4-1 
PRINT4—1 

48 










The same answer appears for each example as soon as you press 
|.Return The spacing in math problems is unimportant to the com¬ 
puter. Try out problems of your own. Make long problems that com¬ 
bine subtraction and addition functions. 

The multiplication sign—the asterisk (*)—is located on the Right 
Arrow key [SJ . The division sign is the slash (/) on the Question Mark 
key Type the following statements: 

PRINT 2 * 2 
PRINT C2*2> 

PRINT 6/3 
PRINT C6/3J 

The computer not only understands the use of parentheses in math 
problems but needs them when the problems become complex. Notice 
what happens in this problem with and without parentheses: 

PRINT 3* £2 + 2 J 
PRINT 3*2 + 2 

The answer to the first problem is 12; the answer to the second prob¬ 
lem is 8. In the first problem, the computer first adds 2 and 2, then 
multiplies by 3 to arrive at 12. In the second problem, the computer 
multiplies 3 and 2 first, then adds 2 to arrive at 8. Whenever the com¬ 
puter encounters parentheses in a math problem, it does the computa¬ 
tions inside the parentheses first and then finishes the rest of the 
calculations. 

Try out the problems below to discover some other interesting facts 
about how your computer works. See if you can predict the answers 
before you press | Return I 

PRINT C2+2J*3 
PRINT 2 + 2*3 

In the first problem, the computer does the computation inside the 
parentheses first. In the second problem, the computer does the 
multiplication first, then the addition. The computer executes these 
mathematical functions according to rules of order: first, computations 
inside parentheses; second, exponential functions; third, multiplication 
and division functions as they appear in the problem from left to right; 
and last, addition and subtraction functions from left to right. The rules 
are summarized in the following table: 


49 












Order of Mathematical Execution 

1. ( ) Computations 

in parentheses 

2. A Exponential 

functions 

3. * Multiplication 

/ Division 

4. + Addition 

Subtraction 


In order of appearance 
from left to right 
In order of appearance 
from left to right 


RANDOM NUMBERS 

The computer can perform other functions that your calculator most 
likely cannot do. For example, your computer can pick random 
numbers for you. Type the program below: 

NEM 

18 PRINT RND (0J 
20 GOTO 10 
RUN 

RND is the command for generating random numbers. The infinite 
loop in the program above will generate random numbers endlessly. 
Remember to break the loop with the I Break I key. To make changes in 
the program, you can just list the program and use the cursor keys to 
insert characters, rather than retype entire.lines. Try out the various 
programs below: 

10 PRINT RND (11 
RUN 

10 PRINT RND (1233 
RUN 

10 PRINT RND (503 
RUN 

10 PRINT RND (500003 
RUN 

All four variations of line 10 generate random numbers between 0 and 
1. The decimal point is always before the first digit in a random number. 
The few random numbers that have a number on the left side of the 
decimal point are still between 0 and 1 but are so small that the com¬ 
puter has written them in scientific notation. 











The number in the parentheses is called a “dummy variable.’’ It does 
not matter what number is used as the dummy variable, but it is im¬ 
portant that the parentheses appear and that they enclose something 
(any number or letter). For typing ease, 0 is usually placed in the 
dummy variable position. Change line 10 again as shown below: 

10 PRINT CRNDC0) * 10) 

RUN 

10 PRINT CRNDC0) * 100} 

RUN 

10 PRINT CRNDCO) * 1000) 

RUN 

Each program generates a different range of random numbers. PRINT 
(RND(O) * 10) generates numbers up to 10 because the statement in¬ 
structs the computer to multiply the random number by 10. Multiplying 
by 10 moves the decimal point over one place. In PRINT (RND(0) * 
100), multiplying by 100 moves the decimal point over two places, and 
in PRINT (RND(0) * 1000), multiplying by 1000 moves the decimal 
point over three places. If you want, you can multiply by much larger 
numbers to generate large random numbers. 

Because long numbers with many digits after the decimal point are 
cumbersome, the computer has an instruction that tells it to print only 
integers. Integers are whole numbers without any decimal points. The 
instruction I NT tells the computer to drop everything after the decimal 
point. Reprogram the three variations of line 10 above and compare 
the results: 

10 PRINT INTCRNDC0)M10) 

RUN 

10 PRINT INTCRNDC0)*100) 

RUN 

10 PRINT INTCRNDC0)*1000) 

RUN 

The programs generate numbers in the same ranges as before, but 
the numbers are more readable without the digits after the decimal. 

To generate numbers in a more specific range, try the examples 
below: 

10 PRINT INT CRNDC0)*3) 

RUN 

10 PRINT INT CRNDC0)M12) 

RUN 

10 PRINT INT CRNDC0)*25) 

RUN 


51 











The program generates random numbers that are always one less 
than the number by which they are multiplied. The first line 10 
generates the numbers 0, 1, and 2. To generate random numbers 0, 1, 
2, and 3, the program would be written this way: 

10 PRINTINT (RNDC0)*4J 
RUN 

To generate only the numbers 1, 2, and 3, the program should look 
like this: 




10 PRINT INT CRNDC0)*3)+1 
RUN 


To generate three numbers starting at 20, write the program this way: 

10 PRINT INT CRNDC0)*3)+20 
RUN 


Random Number Game 

Random-number programs are very flexible. You can even use them to 
play games with your computer. Type the following program. 
Remember that to get the bent arrow in line 5, press I Esc I . hold down 
| Shift | or I Control | , and press I Clear I . 


NEM 

1 REM *** NUMBER . GAM *** 

5 PRINT " ^ " 

10 SECRETNUM=INTCRNDC0)*3)+1 

20 PRINT : PRINT "I AM THINKING OF A NUMBER, EITHER 1,2, 
OR 3 . TRY TO GUESS IT. " 

30 INPUT GUESS 

40 IF GUESS=SECRETNUM THEN PRINT "YOU HON. " 

50 IF GUESSOSECRETNUM THEN PRINT "YOU LOST. " 

50 GOTO 10 


Line 10 assigns the random number to the numeric variable called 
SECRETNUM. Line 30 lets the user type in a guess and assigns this 
number to the numeric variable called GUESS. (Remember that 
numeric variables do not need to be dimensioned or tagged at the end 
the way that string variables do.) Line 40 compares the guess to the 
secret number. If they equal each other, the computer prints “YOU 
WON." Line 50 also compares the guess to the secret number. If they 
are not equal (the symbols < > mean not equal to), the computer prints 
"YOU LOST." Line 60 makes a loop so that you can play the game 
again. (The next chapter explains IF-THEN statements in more detail.) 


52 















MATH PROGRAMS 


The computer's mathematical functions can be used for work pur¬ 
poses, as well as for play. If you were a chef who prepared food for 
banquets, you might need a computer to expand your recipes. For 
instance, suppose that you are trying to figure out how many pounds 
of sea scallops to buy to serve Coquilles St. Jacques at a dinner for 62 
guests. Your recipe indicates that 1 1/2 pounds of scallops feeds 5 
people. The program below would tell you how many pounds to buy: 

NEH 

1 REM *** COQUILLE *** 

16 PRINT " Fi 11 
26 GUESTS=62 

36 P0UND3T0BUY= 1.5/5 * GUESTS 

40 PRINT:PRINT "BUY ";POUNDSTOBUY;" POUNDS OF 
SCALLOPS. 11 
50 END 

The program produces the answer (18.6 pounds of scallops), but a 
calculator would achieve the same result with less work To make the 
program more useful, allow a variation in the number of guests by in¬ 
serting an INPUT statement. Type in the additional lines below: 

15 PRINT: PRINT "HOMMANY GUESTS DO YOU EHPECT?" 

20 INPUT GUESTS 

Run the program several times, entering a different number of guests 
each time. The amount of scallops needed changes each time. For 
200 guests, 60 pounds of scallops are required; for 436 guests, 130.8 
pounds. The INPUT function makes the program more practical. 


53 





I 

i 

« 

# 


54 







Making Decisions 
and Solving Problems: 

^ IF-THEN, FOR-NEXT 

The IF-THEN and FOR-NEXT commands enable you to write programs 
that mimic the way humans approach a decision or a problem. 
Especially useful for games and logic puzzles, the commands let you, 
the programmer, make the choices for the computer. 

IF-THEN COMMANDS 

To practice the IF-THEN statement, type in the following program: 

NEW 

1 BEM *** BRNPROBE . QZ *** 

5 PHIMT " H " 

IB DIM RAIN$ (31 

20 PRINT : PRINT "YES OR NO, IF IT MERE RAINING OUTSIDE, 
MOULD YOU GO OUT HITH AN UMBRELLA"; 

30 INPUT RAINS 

40 IF RAIN$="YES" THEN PRINT "YOU HAVE A FORMIDABLE IQ . " 
50 IF RAIN$="NO" THEN PRINT "YOU ARE A BORN RISK TAKER. " 

The Brainprobe Quiz evaluates your answer. In line 40, if the answer 
stored in the string variable RAIN$ is yes, the computer prints the IQ 
message. If the answer is not yes, the computer reads the next line, 
line 50, and evaluates the string variable RAINS again. If the answer is 
NO, the computer prints the risk-taker message. However, if you 
answer neither yes nor no, the program just ends. The program has no 
instructions for responding to an indefinite answer. Try it out. 

One way to encourage an expected reply is to create an infinite loop. 
Insert the additional line below: 

60 GOTO 20 

Evaluating with IF-THEN 

Another way to encourage a correct answer is to provide hints. The 
following program uses numeric variables to elicit a correct response: 

NEH 

1 REM *** NUMBER . QZ *** 

5 PRINT " H 11 

10 SECRETNUM=INT(RND(01*101+1 

20 PRINT : PRINT "GUESS A SECRET NUMBER BETHEEN 1 AND 10. 11 

55 







I 


38 PRINT 

40 PRINT "YOUR GUESS"; 

50 INPUT GUESS 
60 PRINT 

70 IF GUESS=SECRETNUM THEN PRINT "YOU GOT IT ! " : END 
80 IF GUESS<SECRETNUM THEN PRINT "TOO LON. TRY AGAIN. 11 
GOTO 40 

90 IF GUESS>SECRETNUM THEN PRINT "TOO HIGH. TRY 
AGAIN.":GOTO 40 


Lines 80 and 90 evaluate the guess as greater than or less than the 
secret number. The PRINT statement provides a hint that the next 
guess should be higher or lower. The GOTO commands in lines 80 and 
90 create an infinite looo if you continue to guess incorrectly. 

Ending the Program 

The Number Quiz is programmed to stop only when you discover the 
secret number. When you enter the correct answer, line 70 gives the 
computer the instruction to end. END stops the program, and the 
Ready prompt appears on your screen. 

Trapping Errors 

If you accidentally enter a letter instead of a number for GUESS, the 
computer sends an Error message, and the program ends abruptly. 
Make an intentional error by typing a letter key or pressing the | Return J 
key only. To avoid ending the program, you can use a TRAP command 
to trap the Error message. Add the lines below and run the program 
again: 

45 TRAP 100 

100 PRINT : PRINT "PLEASE ENTER A NUMBER ONLY . " 

110 GOTO 30 

In line 45, the TRAP command tells the computer not to stop the 
program when a mistake is entered and sends the computer to line 
100. Line 100 tells the computer to print the directions for correcting 
the mistake. Line 110 returns the computer to the place where it left 
off. The TRAP statement always comes before the INPUT statement, 
and it always contains the number of the line that will resolve the 
problem. 

Quiz Writing with IF-THEN 

A program can easily provide hints when the correct answer is a 
number, including a date. The following program uses IF-THEN 
statements and the TRAP command to evaluate guesses: 

56 










NEN 

1 REM *** LOVELACE . QZ *** 

5 PRINT "IS" 

10 PRINT : PRINT 11 ADA LOVELACE.. DAUGHTER OF THE POET LORD 
BYRON ^ MAS MATHEMATICALLY BRILLIANT . 11 
20 PRINT 

30 PRINT "IN MHAT YEAR DID SHE HRITE HER AMAZINGLY 
ACCURATE DESCRIPTION OF THE FUTURE USES OF THE 
COMPUTER "} 

40 TRAP 200 
50 INPUT GUESS 

60 IF GUESS=1842 THEN GOTO 100 
70 IF GUESS<1842 THEN GOTO 110 
80 IF GUESSM842 THEN GOTO 120 

100 PRINT: PRINT "CONGRATULATIONS! YOU GUESSED THE YEAR 
CORRECTLY.":END 

110 PRINT: PRINT "THAT MAS TOO EARLY. TRY AGAIN. " : GOTO 20 
120 PRINT: PRINT "THAT MAS TOO LATE. TRY AGAIN. " : GOTO 20 
200 PRINT .-PRINT "PLEASE ENTER A NUMBER ONLY. " 

210 GOTO 20 

in the Lovelace Quiz, the placement of the PRINT messages 
associated with the IF-THEN statements is different from their place¬ 
ment in the Brainprobe Quiz and the Number Quiz. This difference 
illustrates that there is often more than one way to achieve the same 
results in programming. 

Computer Bugs 

The TRAP statement makes the Lovelace Quiz more errorproof, but it 
still is not perfect. Because the computer evaluates the date as a 
number, it will accept 1842.78 as incorrect but 1842,78 as correct. 
Most programs have “bugs," or problems. When you can figure out 
the bugs and fix them, you have really learned to program. Every 
beginner encounters many bugs and makes many mistakes. To 
become a better programmer, study this manual, refer to the ATARI 
BASIC Reference Guide , and perhaps have a more experienced 
person look over your shoulder occasionally. You will learn how to 
identify bugs so that you can avoid similar mistakes in future 
programs. 

FOR-NEXT LOOP: THE COUNTING LOOP 

You are already familiar with the infinite GOTO loop. Another kind of 
loop is the FOR-NEXT loop. The FOR-NEXT loop is a counting loop, 
which is not infinite. Type NEW and enter the following program: 


57 









NEN 

18 FOR X=1 TO 4 
20 PRINT "POTATO" 

30 NEXT X 
RUN 

POTATO appears on the screen four times. Change line 10 to read like 
this: 

10 FOR X=1 TO 7 

When you run the program this time, the screen shows POTATO seven 
times. The computer is looping seven times through lines 10, 20, and 
30. FOR tells the computer how many times to loop, and NEXT tells 
the computer to go back to the top and start again. NEXT is similar to 
GOTO. X is a variable. You can use anything to represent the variable. 
Try this name for the variable: 

10 FOR NUM=1 TO 7 
30 NEXT NUM 

When you run the program, there is no difference from the previous 
program. Change the variable name again: 

10 FOR JKL=1 TO 7 
30 NEXT JKL 

JKL is a nonsense name for the numeric variable in the FOR-NEXT 
loop. Run the program to see that it, too, runs the same as before. 

Now add this line: 

15 PRINT JKL^ 

RUN 

The PRINT statement in line 15 shows the value of the variable. (Put 
the comma in for readability.) Each time the computer repeats the 
FOR-NEXT loop, the variable takes on the value of the next number in 
the series specified in line 10. The first time, the variable is 1; the 
second time, 2; and so on. The last number in the FOR statement 
controls the number of times the computer loops through the program. 
Change that number in line 10 as shown below: 

10 FOR JKL=1 TO 50 
RUN 

10 FOR JKL=1 TO 200 
RUN 

10 FOR JKL=1 TO 500 
RUN 


58 







Starting Point 

List the program. The first number in the FOR line is the starting point 
for the count, and the last number is the stopping point. Even negative 
numbers can be the starting point for the count. Try these variations 
for line 10: 

10 FOR JKL = 1 TO 5 
RUN 

10 FOR JKL=0 TO 5 
RUN 

10 FOR JKL-3 TO 5 
RUN 

10 FOR JKL=-10 TO 5 
RUN 

STEP: Counting Incrementally 

List the program, delete the PRINT statement in line 20 and the 
comma in line 15, and run the program. The computer counts and 
prints the numbers very quickly. Use the STEP command to make the 
computer count in increments. Try the program below: 

10 FOR JKL=0 TO 500 STEP 5 
RUN 

10 FOR JKL=0 TO 500 STEP 2 
RUN 

10 FOR JKL=0 TO 500 STEP 100 
RUN 

10 FOR JKL=0 TO 500 STEP 7 
RUN 

The computer will obligingly count by any sequence you specify. 

Counting Backward 

The computer can count backward if you use the STEP -1 command 
and the proper sequence of numbers (from larger to smaller) for 
starting and stopping the count. For example: 

10 FOR JKL=5O0 TO 0 STEP -1 
RUN 

10 FOR JKL-10 TO 0 STEP -1 
RUN 

10 FOR JKL=-1 TO -IS STEP -1 
RUN 


59 








The computer can count backward in increments also: 

10 FOR JKL=50O TO O STEP -20 
RUN 

10 FOR JKL=50O TO O STEP -3 
RUN 

10 FOR JKL=0 TO -50O STEP -SO 
RUN 

You can also instruct the computer to start and stop at any number 
you desire: 

10 FOR JKL=50O TO 300 STEP -10 
RUN 

10 FOR JKL=25 TO 0 STEP -1 
RUN 

Now you know how to instruct the computer to count forward and 
backward, to count consecutively and incrementally, and to start and 
stop at specified numbers. 

The FOR-NEXT “Sandwich” Loop 

List your program. FOR is on the top line, and NEXT is on the bottom 
line. Whatever you want the computer to do is sandwiched in between 
Type in the lines below: 

10 FOR JKL=i TO 5 

20 PRINT 11 AVOCADO" 

The computer will carry out any instruction or number of instructions 
between the FOR and NEXT statements the specified number of times 
Have the computer print other words: 

16 PRINT "CHEESE" 

17 PRINT "MAYONNAISE" 

18 PRINT "MUSTARD" 

19 PRINT "TOMATO" 

21 PRINT "BACON BITS" 

22 PRINT "LETTUCE" 

23 PRINT:PRINT 
RUN 

The computer prints and counts too quickly for anyone to read the 
screen clearly. Nonetheless, it prints the PRINT statement exactly five 
times as instructed in the FOR-NEXT statement. Other instructions, 
such as math computations and INPUT statements, can also be part 
of the FOR-NEXT sandwich loop. 


60 







Delay Loops 

Erase all the PRINT statements so that absolutely nothing is in the 
FOR-NEXT sandwich loop, except the FOR and the NEXT statements. 
Run the program and see what happens: 

15 

16 

17 

18 
13 
28 
21 
22 
23 

LIST 

RUN 

Nothing happens. Change the number in line 10 and watch carefully 
again: 

10 FOR JKL = 1 TO 500 
RUN 

The Ready prompt takes a few seconds to appear. Change line 10 
again: 

10 FOR JKL=1 TO 5000 
RUN 

This time the Ready prompt takes considerably longer to appear. The 
computer is counting but not printing its calculations. The process is 
similar to counting silently to yourself. The time it takes the Ready 
prompt to appear on the screen is the time it takes the computer to 
count to 5000. 

FOR-NEXT loops are excellent devices for keeping the computer from 
moving on. In fact, FOR-NEXT loops are used so frequently for this 
purpose that they are sometimes called “delay loops,” and the 
common variable name is DELAY. Rewrite the FOR-NEXT loop, using 
DELAY as the variable name and different numbers in the FOR 
statement: 

NEH 

10 FOR DELAY=1 TO 300 

20 NEXT DELAY 

LIST 

RUN 


61 







Sometimes the delay loop is sandwiched on the same program line: 

NEH 

16 FOR DELAY=1 TO 30O:NEKT DELAY 
LIST 

RUN 

Sample Programs 

The programs below use FOR-NEXT loops in a variety of ways. The 
first program uses the FOR-NEXT loop as a simple delay loop to leave 
the word HI on the screen long enough to be read before line 30 
clears the screen: 

NEM 

1 REM *** DLAYLOOP *** 

5 PRINT 11 IS 11 
10 PRINT "HI" 

20 FOR DELAY=1 TO 800:NEKT DELAY 
30 PRINT " IS " 

40 PRINT "BYE" 

50 FOR DELAY=1 TO 800: NEXT DELAY 

The next program uses a numeric variable in the FOR-NEXT loop. It 
also uses a TRAP command that refers the computer back to the 
previous line, giving no specific message about the error: 

NEM 

1 REM *** HOHHIGH? *** 

10 DIM AS Cl) / HHSC1) 

20 PRINT " IS " 

30 PRINT : PRINT "HOH HIGH DO YOU HANT TO COUNT " ; 

40 TRAP 30 
50 INPUT HH 

55 HH$=5TR$CHH) : IF HH$="0" THEN GOTO 30 
80 FOR COUNT=l TO HH 
70 PRINT COUNT 
80 NEXT COUNT 

80 PRINT : PRINT "PLEASE ANSMER CY/N) . MOULD YOU LIKE TO 
COUNT AGAIN" } 

100 TRAP 90 
110 INPUT A$ 

120 IF A$ = "Y" THEN GOTO 30 

130 IF A$="N" THEN PRINT:PRINT "BYE"SEND 
140 GOTO 90 

The last program paraphrases an old rock ’n’ roll song and uses 
“nested” FOR-NEXT loops. A nested FOR-NEXT loop is a smaller 
delay loop inside a larger FOR-NEXT loop. The program also uses OR 
to create multiple conditions in the IF-THEN statement: 

62 





NEW 

1 REM *** CLOCKRCK *** 

5 PRINT N ^ " 

10 FOR X = 1 TO 9 
20 PRINT H; 

30 PRINT " O'CLOCK" 

40 FOR DELAY=1 TO 5O0:NEXT DEL AY 

50 IF X —3 OR X = 6 OR X = 9 THEN PRINT "ROCK ! " : FOR PAUSE=1 
TO 500 : NEXT PAUSE 
60 NEXT X 

70 PRINT:PRINT "WE 1 RE GOING TO ROCK" 

80 PRINT "AROUND THE CLOCK" 

SO PRINT "TONIGHT! " 


63 












Producing Sound and Graphics: 


SOUND, SETCOLOR, COLOR 

Creating sound and graphics on some computers is very complicated, 
but not on the ATARI 130XE. The SOUND command of ATARI BASIC, 
combined with some simple programming techniques, is all you need. 
Sound and graphics add new dimensions to your BASIC programs— 
anything from arcade-game zaps and cracks, musical themes, and 
songs to colorful graphic displays. 

SOUNDING OFF 

Your ATARI 130E can play up to four sounds at one time. The four 
sound registers, or voices, are numbered 0, 1,2, and 3. To select the 
first voice, you type SOUND 0; for the second, SOUND 1; for the third, 
SOUND 2; and for the fourth, SOUND 3. 

The SOUND command in ATARI BASIC controls four elements: 

voice (0-3) 
pitch (0-255) 
distortion (0-14) 
volume (0-15) 

The pitch, or frequency, of the sound is determined by a number from 
0 to 255, giving you a total of 256 frequencies from which to choose. 
The pitch value is the second number in the SOUND command. 
SOUND 1,50 specifies the second voice with a pitch of 50. Make sure 
that the volume is turned up on your TV or monitor, then type 

SOUND J.^50^0^8 

Press 1 Return I . A great explosion, isn’t it? To turn off the sound, you 
just turn down the volume on your television, or type either of the 
commands below and press | Return I : 

END 

SOUND l/O/O^O 

The purity, or distortion, of the sound is determined by any even 
number between 0 and 14. In the SOUND command, the purity of the 
sound is the third number. Try this: 

SOUND i.,50,,10,8 


65 














The number 10 produces a pure tone without distortion. To put in a 
little distortion, change the 10 to 06: 

SOUND 1,50/06^8 

The computer sounds as if it’s ready for takeoff. Type END before the 
neighbors start complaining. 

The last number in the SOUND command controls the volume. The 
number must be between 0 and 15. Number 8 is a good number for 
most uses. You risk damaging your TV speaker and your ears if you go 
above 12. 

To try some four-part harmony, enter the following: 

SOUND 0/50/10/8 
SOUND 1/100/10/8 
SOUND 2/150/10/8 
SOUND 3/200/10/8 

Type END to stop the chorus. 

Sounding Off with Variables 

Variables in SOUND commands add versatility to your programs. 

Using variables, you can program the computer to change the voice, 
pitch, distortion, and volume of sustained sounds. Enter and run the 
following program: 

NEM 

10 REM * SET VARIABLES FOR SOUND VALUES 
20 V0ICE=0:PITCH=1O0:T0NE=8:VOL=8 
30 SOUND VOICE/PITCH/TONE/VOL 
40 GOTO 20 
RUN 

To stop the sound, press the I Break I key and type END. To sustain a 
sound, you need to repeat the SOUND command in the program. Two 
common methods are a FOR-NEXT loop or a GOTO loop like the one 
in the example above. The following program uses a variable for the 
pitch in a FOR-NEXT loop to produce the computer’s entire range of 
pitches: 


66 










NEW 

10 REM * SOUND EFFECTS WITH FOR-NEKT LOOP 

28 UOICE = 0:PITCH=0:TONE=10:U0L=8 

30 FOR PITCH = 0 TO 255 

40 SOUND VOICE^PITCH^TONE^ VOL 

50 NEHT PITCH 

RUN 

Varying the volume in a program produces a variety of sounds. Change 
VOL = 8 to VOL = 0 and press I Return I . Then add the following line: 

35 VOL=INTCRNDC0)«16) 

This line randomly selects a value between 0 and 15 for the volume 
variable. Run the program to find out how randomly changing the 
volume affects the sound. 

Making Music 

The SOUND command can produce musical tones as well. The follow¬ 
ing scale includes musical notes and their pitch values: 

Note Pitch 

high C 29 


B 

A 

G 

F 

E 

D 

C 

B 

A 

G 

F 

E 

D 


31 

35 

40 

45 

47 

53 

60 

64 

72 

81 

91 

96 

108 

121 


middle c 


Type and run the following program: 

NEW 

10 REM ** SIMPLE SONG 
15 DIM PITCH® Cl) 

20 VOICE=0:PITCH=0:TONE=10:V0L=8 
38 REM ** C=121:D=108:E=96:F=91 
40 TRAP 300 
50 PRINT " fS " 


67 







66 PRINT "NOTES FOR SIMPLE SONG" 

65 FOR NOTE= 1 TO 8 
70 READ PITCH 

80 SOUND VOICE,PITCH,TONE..VOL 

90 GOSUB 20O 

100 PRINT: PRINT PITCH® 

110 FOR PAUSE=1 TO 500 : NEXT PAUSE 
120 SOUND 0,0,0,0 
130 NEXT NOTE 
140 GOTO 300 

150 REM ** DATA FOR NOTES 

160 DATA 121,121,108,96,96,91,108,121 

2O0 REM ** PRINT NOTES 

210 IF PITCH=121 THEN PITCH$="C" 

220 IF PITCH=108 THEN PITCH$="D" 

230 IF PITCH=96 THEN PITCH$="E" 

240 IF PITCH=91 THEN PITCH$="F" 

250 RETURN 

300 PRINT : PRINT "END OF SIMPLE SONG" : END 
RUN 

The GOSUB-RETURN and READ-DATA commands allow the computer 
to produce different notes by inserting a series of values for the 
variable PITCH. GOSUB tells the computer to go to the “subroutine” 
that starts at line 200 and continues to line 250; the RETURN com¬ 
mand sends the computer back to the line immediately below the 
GOSUB line. The READ command tells the computer to pick up an 
item in the DATA line and insert it into the variable. The computer con¬ 
tinues to loop through the program until all the values in the DATA line 
have been used. 


The program also uses a FOR-NEXT loop to determine how long the 
notes last. Using different FOR-NEXT loops, try modifying the program 
to produce whole notes, half notes, and other kinds of notes. 

For more information about programming with sound, refer to the 
Resources section of this guide. 

COLORFUL GRAPHICS 

Your ATARI 130XE has 16 graphics modes encompassing 256 colors. 
To get you started, this section presents 6 different modes and some 
of the most essential graphics commands. 

The following chart lists the 16 basic colors and their corresponding 
number values. (The colors vary somewhat according to the adjust¬ 
ment of the hue control on your television set.) 


68 









6 Red-orange 

7 Blue 


4 Pink 

5 Purple 


0 Gray 
1 Gold 


2 Orange 

3 Red-orange 


8 Blue 

9 Light blue 

10 Turquoise 

11 Green-blue 

12 Green 

13 Yellow-green 

14 Orange-green 

15 Light orange 


The remaining 112 colors are obtained by adding a value for 
luminance, or brightness. The luminance must be an even number 
between 0 and 14. The higher the luminance number, the lighter and 
brighter the color. 

Color registers are another important element in ATARI graphics. The 
color registers can be thought of as paint cans. Each register can hold 
any of the 128 colors. Because there are five registers, a maximum of 
five different colors can be displayed. The five color registers are 
numbered 0, 1, 2, 3, and 4. 

SETCOLOR is an essential graphics command. The format is 
SETCOLOR 2,10,8: the first number is the color register; the second is 
the color number; and the third is the luminance. 

Graphics Mode 0 

The color registers function differently in different graphics modes. 
Their functions in graphics mode 0 (the text mode) are shown in the 
chart below: 

Default Colors Register Function 


0 Not used 

1 Brightness of text 

2 Background 

3 Not used 

4 Border 


Light blue 
Dark blue 


Black 


The default colors are the colors that the computer automatically uses 
unless you instruct it to use some other colors. Using SETCOLOR to 
change colors, type in the following: 

SETCOLOR 2, Z, 4 

When you press I Return | , the screen turns orange. The color transfor¬ 
mation occurs because in the SETCOLOR command, the 2 represents 
the screen color, the 3 equals the color orange, and the 4 indicates 
the brightness. Change the 4 to a 6. The orange changes to a lighter 
orange. Change the 6 to a 7. Nothing happens because only the even 


69 











numbers between 0 and 14 define the luminance. If you type an odd 
number, the computer uses the color of the previous even number. 
Change the 7 to an 8 and watch the color get lighter yet. The following 
program shows 128 colors and luminances: 

NEM 

10 REM »» 128 ATARI COLORS 

20 REM ** 16 COLORS 

30 FOR C0L0R=0 TO 15 

40 REM »» 8 LUMINANCES 

50 FOR LUMINANCE=0 TO 14 STEP 2 

60 SETCOLOR 2..COLOR..LUMINANCE 

65 PRINT "COLOR=";COLOR; M LUMINANCE=";LUMINANCE 

70 REM m» PAUSE TO SEE COLOR 

80 FOR PAUSE=1 TO 600: NEXT PAUSE 

90 NEXT LUMINANCE 

100 NEXT COLOR 

RUN 

When the luminance reaches number 10, the text disappears because 
the default luminance of the text is also 10. (The default luminance is 
the luminance that the computer automatically uses unless it is 
instructed to do otherwise.) Whenever the background luminance is 
the same as the text luminance, the text seems to disappear. Pay 
attention to background and text luminances as you work more with 
color and luminance in graphics mode 0. Type GR.O (which is an 
abbreviation for graphics mode 0) to restore the normal screen colors. 

Change SETCOLOR 2 to SETCOLOR 4 in line 60 and run the program 
again. Because register 4 governs the border, the border changes 
color this time instead of the background area. Type GR.O to restore 
the normal screen colors. 


Graphics Modes 1 and 2 

Graphics modes 1 and 2 provide large-size text and color options. 
Graphics mode 2 is identical to graphics mode 1 except that each 
character is twice as tall. Mode 1 has 24 horizontal screen lines, &nd 
mode 2 has 12. To enter graphics mode 1, type 

NEM 

18 GRAPHICS 1 

28 PRINT tt6; "GRAPHICS MODE ONE" 

Run the program. Graphics mode 1 is in orange text at the top of the 
screen. At the bottom is a blue strip containing the word READY. The 
blue strip is the text window and displays text in graphics mode 0. 
Type GR.O to return to the text mode. 


70 











To print large text on the screen in graphics modes 1 and 2, use 
PRINT #6; followed by quotes and then the text that you want to print. 
This statement is a variation on the PRINT command that you learned 
earlier. 


Now list the program. Change MODE to mode and run the program. 
MODE turns green. Type LIST 20. Using the Inverse Video keyB, 
change mode in line 20 to ■ juiasp and run the program. MODE now 
turns blue. List the line again and change EE03 to lMJ.U and run 
the program. Now MODE is red. 


Enter and run the following program: 


NEM 

16 REM ** COLORFUL TEXT 
20 GRAPHICS 1 
30 PRINT »6; "ORANGE" 

40 PRINT «6; M green" 

50 PRINT «6; "| 

60 PRINT »6; "| 

70 PRINT "COLORFUL TEXT' 
RUN 


DARK Rl LJF 


As you can see, graphics mode 1 is capable of displaying five colors 
at the same time—four different text colors and one background color. 
The colors can also be changed by using SETCOLOR according to the 
guidelines outlined in the following chart: 


Register 

Default Color 

Character Style 

Color# 

LUM 

0 

Orange 

Uppercase 

2 

8 

1 

Light green 

Lowercase 

12 

10 

2 

Dark blue 

Inverse uppercase 

9 

4 

3 

Red 

Inverse lowercase 

4 

6 

4 

Black 

Background 

0 

0 


Type SETCOLOR 4,15,5. Register 4 (the background) changes to a 
reddish orange. But now the dark blue text is difficult to read. Use 
SETCOLOR to change it. According to the chart, register 2 controls 
the dark blue text. SETCOLOR 2,8,6 does the trick by making the dark 
blue text a little bit lighter. Add the following lines to the Colorful Text 
program: 

100 FOR C0L0R=0 TO 15 

110 SETCOLOR 2,COLOR,8 

120 FOR DELAY=1 TO 400:NEXT DELAY 

130 NEXT COLOR 


71 












Run the program. The text window at the bottom of the screen 
changes color along with the dark blue text because register 2 
governs the text window as well as the text display. 

Getting Rid of the Text Window 

Sometimes you may not want the text window to appear in your pro¬ 
grams. To eliminate the text window, simply add 16 to the graphics 
mode number. Change line 20 to GRAPHICS 17 and delete line 70. 

The PRINT command will always print in graphics mode 0. If you are 
in modes 1 or 2, if you don’t have a text window, and if you use the 
PRINT command and the PRINT #6; command, the computer gets 
confused and prints everything in mode 0. Add this line: 

70 PRINT "MINDOM TEST" 

Run the program to see what happens. If you use PRINT and PRINT 
#6; you must use a text window to have mode 1 show up on the 
screen. 

Delete lines 100, 110, 120, and 130. Run the program. WINDOW TEST 
and then READY appear at the top of the screen. List the program. 
Line 20 specifies mode 17 (mode 1 without the text window), but 
where is it? Replace line 70 with this line: 

70 GOTO 70 

When you run the program, the mode 1 screen comes back. When 
you use mode 1 or 2 without a text window, you must use a GOTO 
loop to keep the display on the screen or it will flash by too fast to be 
seen. Pressing the I Break I key returns you to mode 0. 

To see an example of mode 2, list the Colorful Text program and 
change line 20 to 

20 GRAPHICS IS 

Graphics 18 stands for mode 2 plus 16 (no text window). Run the 
program. Now you have LARGE colorful text. 

To return the screen to its original colors, press the I Reset I button or 
type SETCOLOR 2,9,4. You will not lose your program when you press 
I Reset I in ATARI BASIC. However, that feature may not apply to other 
languages or programs. 


72 












Graphics Mode 3 

The graphics mode 3 screen is a grid consisting of 40 columns and 24 
rows (20 if you use the text window). Enter and run the following 
program: 

NEM 

10 GRAPHICS 3 
28 COLOR 1 
30 PLOT 0,0 
RUN 


In the upper left corner is an orange block. The block, or pixel, is one 
unit in the graphics screen. The COLOR command determines the 
color of the pixel. The number after the COLOR command determines 
which color register to use for the color of the pixel. The COLOR com¬ 
mand does not place a color in the register; SETCOLOR does that. The 
COLOR command simply selects which register to use to plot the 
pixel, and the pixel becomes whatever color is in the register. To make 
this clearer, change line 20 to 

20 COLOR 2 

Run the program. The orange pixel is now light green. Think of each 
pixel as a text character. In modes 1 and 2, you used uppercase and 
lowercase characters and Inverse Video to select the colors of the 
text. In modes 3 and above, use the COLOR command to select the 
color for the pixels. 


PLOT: Plotting Points on the Grid 

PLOT is like the PRINT #6; command except that it prints pixels in¬ 
stead of letters and numbers. COLOR is like the upper/lower/inverse 
color selection method; it selects the register. The default colors are 
orange, light green, dark blue, and black. To change the color in any 
of the registers, use the SETCOLOR command. 

The color registers are like four buckets of paint. SETCOLOR selects 
the color that goes into each of the four buckets, and COLOR selects 
the bucket into which the paintbrush will be dipped. PLOT determines 
where the brush will be positioned on the screen. 

DRAWTO: Connecting the Dots 

Add this line: 

40 DRAWTO 39,0 

73 









Run the program. A light green line goes across the top of the screen. 
After plotting a pixel, use the DRAWTO command to plot a second 
pixel and draw a connecting line between the two. Line 40 tells the 
computer to plot a pixel at column 39, row 0, and then connect them. 
Now type 

DRAWTO 39/19 

The command plots a pixel in the bottom right corner of the graphics 
screen, just above the text window, and then draws a line to connect 
39,0 to 39,19. Now type 

DRAWTO 0,19 

To complete the rectangle, type 

DRAWTO 0/0 

Now type GR.O and list the program. Add these lines: 

50 DRAWTO 39/19 
60 DRAWTO 0/19 
70 DRAWTO 0/0 

SETCOLOR and COLOR 

When you run the program, the computer draws a green rectangle 
again. To brighten up the screen, type 

35 COLOR 1 
45 COLOR 2 
55 COLOR 1 
65 COLOR 3 

Run the program to see a rectangle of many colors. 

To change the color in a register, use SETCOLOR. You might conclude 
that COLOR 1 selects the color for register 1 and that COLOR 2 
selects the color for register 2. Unfortunately, that conclusion is not 
quite true. Mode 3 has four registers and four colors—but the 
registers are numbered 0, 1, 2, and 4, and the colors are numbered 0, 

1, 2, and 3. To keep things straight, make a chart: 


Color 0 = Register 4 
Color 1 = Register 0 
Color 2 = Register 1 
Color 3 = Register 2 


Black 
Orange 
Light green 
Dark blue 


74 








Type GR.O, list the program, and change COLOR 2 in line 20 to 
COLOR 1. COLOR 1 selects register 0, and orange is the default color 
for register 0. To change the color in register 0, use the SETCOLOR 
command. Add the following line: 

15 SETCOLOR 0..4..6 

When you run the program, the orange lines change to a pinkish color. 
You have changed the color of the lines by using SETCOLOR to 
change the paint in the bucket (the color in the register), not by using 
COLOR to choose a different bucket (register). The color luminance of 
register 0 also affects the luminance of the text in the text window. 

Now add 

42 SETCOLOR 1,2,8 

The light green at the right side of the box turns gold. Add one more 
line: 

62 SETCOLOR 2,11,4 

Run the program. Not only does the left side of the box change to 
green, but the text window also turns green. Therefore, register 2 also 
controls the color of the text window. 

Now you should be able to use SETCOLOR and COLOR to achieve a 
wide variety of colors and hues in your programs. 


Graphics Modes 5 and 7 

The differences among modes 3, 5, and 7 can be illustrated very 
easily. Change line 10 to 

10 GRAPHICS 5 

Run the program. The rectangle is much smaller because the pixels 
are smaller. With the text window, the mode 3 grid has 40 columns 
and 20 rows. The mode 5 grid has 80 columns and 40 rows. 

Now change line 10 to 

10 GRAPHICS 7 

When you run the program, an even smaller rectangle appears. The 
grid in mode 7 is 160 columns by 80 rows. 


75 





The smaller the pixels, the higher the resolution. Of the three modes, 
mode 3 is the lowest and mode 7 is the highest. Try drawing a rec¬ 
tangle around the screen borders in modes 5 and 7. 

The following program illustrates all that you have tried in this section. 
Type it in and run it: 

NEH 

5 REM ** BILL 1 5 BOX CPLOT AMD DRAM) 

IB PRINT "HHICH MODE C3,5, OR 73" 

20 LEFT=0:TOP=0 
30 INPUT MODE 

40 IF M0DE=3 THEN RIGHT=39:B0TT0M=19 
50 IF M0DE=5 THEN RIGHT=79 : B0TT0M=39 
60 IF M0DE=7 THEN RIGHT=159 : B0TT0M=79 
70 GRAPHICS MODE 

80 PRINT 11 GRAPHICS MODE n ;MODE 

90 FOR COUNT=l TO 1000 

100 COLOR 2 

110 TRAP 240 

115 REM ** DRAW BOX 

120 PLOT LEFT,TOP 

130 COLOR 1 

140 DRAWTO RIGHT, TOP 

150 COLOR 2 

160 DRAHTO RIGHT,BOTTOM 
170 COLOR 1 

180 DRAWTO LEFT,BOTTOM 

190 COLOR 3 

200 DRAWTO LEFT,TOP 

205 REM ** DELAY LOOP 

210 FOR DELAY=1 TO 500: NEXT DELAY 

215 REM ** SIZE OF NEXT BOX 

220 LEFT=LEFT + 2 S T0P=T0P + 2:RIGHT=RIGHT—2:B0TT0M=B0TT0M-2 
230 NEXT COUNT 

240 PRINT " THAT 1 S ALL FOLKS ! " 

250 END 


Try using SETCOLOR to change the colors in the Bill’s Box program. 

You can learn a great deal more about ATARI graphics, including how 
to use other graphics modes and create animated characters. Refer to 
Appendix F: Resources to locate books, magazines, and users groups 
that can help you further explore the world of ATARI BASIC and your 
ATARI 130XE Computer. 






Part 3 

Appendices 


77 











78 








A. Sample Programs 

j *V . yy | i 


Your ATARI Computer can work miracles with a little help from your 
imagination and the right programming techniques. These sample pro¬ 
grams will show off the versatility of your ATARI 130XE and motivate 
you to try writing some programs yourself. 

Just type in each program exactly as written, pressing | Return I at the 
end of every line. When you’re finished, type the word RUN, press 
I Return I , and watch your ATARI Computer come to life. 

Note: When spacing in program lines is critical, a note at the bottom 
of the program will specify the exact number of spaces needed. 


THE ATARI CHOO-CHOO 

Sound effects are an ATARI specialty. If you close your eyes when you 
run ATARI Choo-Choo, you might think you're on the Marrakesh 
Express. 

IS POKE 764,255: POKE 580,1 

20 GRAPHICS 17: POKE 712,140: POSITION 1,10:PRINT «6; 
"THE ATARI CHOO-CHOO" 

30 FOR K=15 TO O STEP -l-P:SOUND 1,0,0,H 
40«t=INTCRND C0)*300) + l 

50 IF R=30 THEN SOUND 3, 36, 10, 10: SOUND 2, 48, 10, 

10 : GOSUB 9tf: SOUND 3,0,0,0 : SOUND 2, 0, 0, 0 
60 NEKT K : P=P + 0.03 
70 IF P>=5 THEN P=5 
80 GOTO 30 

90 POKE 77,0: POSITION 8,12: PRINT »6; "toot": FOR A=1 TO 
400: NEKT A: POSITION 8,12: PRINT 1*6;" ": RETURN 

Note: Line 90 requires four blank spaces between the quotation 
marks. 


79 













THE BIG BANG 


Close the door before you run the next program so that you won’t 
disturb the neighbors. 

10 POKE 764,255:P0KE 580, 1 
20 GRAPHICS 17 

30 FOR X=10 TO 100: SOUND 0, X, 10, 10 : SOUND 1, X-2, 10, 8: 
SOUND 2, X + 2, 10, 12 : NEXT X 
40 SOUND 1, 0, 0, 0 : SOUND 2, 0, 0, 0 
50 POSITION 4,11: PRINT "BAROOOOMMM!" 

60 FOR DECAY=15 TO 0 STEP -0.5: FOR B=1 TO 20: 

SOUND 0,100,B,DECAY: POKE 712,B:NEXT B : NEXT DECAY 
70 GRAPHICS 1 + 32 : POKE 712, 148 

88 POKE 752,1: PRINT : PRINT " Press Start to set off 
another explosion." 

90 IF PEEK£53279J<>6 THEN GOTO 90 
100 GOTO 20 

SORT THOSE WORDS 

This sorting program puts words in their proper places—in alphabetic 
order. Replace the words in the DATA statements in lines 10 and 20 to 
sort words of your own choosing. Remember to separate each of your 
words with a comma. 

10 DATA ATARI,DISK DRIVE, MONITOR,COMPUTER,TOUCH 
TABLET,PRINTER,KEYBOARD 

20 DATA SOFTWARE,PROGRAM RECORDER,WORD PROCESSING, 

ACCOUNTING,DATA BASE,FUN 

30 DIM ZSC1000J,AC50J,ASC20J,SC10J 

40 S(1J =1:FOR L = 1 TO 9: SCL + 1J=SCLJ*3 + 1:NEXT L 

50 TRAP 80 : GRAPHICS 0:? "HERE IS THE LIST : " 

60 READ AS:B = LEN(ZS>:C=LENCAS>: ZS 
(B+1,B+1)=CHRSCCJ:? AS 

70 Z$CB + 2,B + 1 + CJ=AS: Q=Q + 1:ACQJ=B + 1:GOTO 60 
80 ? :? "READY TO SORT. . .",:P=0 
90P = P + l:IFStP + 2J<Q THEN 90 

100 FOR I = P TO 1 STEP -1:S=SCIJ : FOR J=S + 1 TO 
Q:L=J-S:A=ACJ) : B=ACLJ 

110 IF Z$CA + 1,A + ASCCZ$CA,A>>J>Z$ CB+1,B+ASC£Z$£B,BJ)} 
THEN 130 

120 A£L+SJ=B:L=L-S:IF L>0 THEN B=AEL) : GOTO 110 
130 ACL + S)-A:NEXT J: NEXT I:? : ? "SORTED. " 

140 FOR L = 1 TO 0:A = ACL): ? Z$£A+1,A+ASC£ZSEA,AJJ)iNEXT L 



PLAYERS AND MISSILES 


This program uses a technique called Player Missile Graphics to 
create a pink monster that moves across your screen in front of a blue 
vertical bar. If you want to make the monster scoot behind the blue 
bar, simply change line 150 to 150 poke 623,4. 

19 POKE 764,255 : POKE 589,1 

29 GRAPHICS 3 + 16 

30 FOR H=16 TO 24 : FOR Y=0 TO 23 : COLOR 3 : PLOT H, Y : NEHT 
Y:NEXTH 

40 MEMTOP—PEEK C 7413 +256*PEEK C 7423—1 

59 PMBASE=INT££MEMTOP-10243 /19243 *1024 

60 ADJT0P=PMBASE + 384 

70 POKE 742,INT £ADJT0P/2563 : 

POKE 741,ADJTOP—256*PEEK C 742 3 
80 POKE 54275,PMBASE/256 
50 POKE 53277,2 
100 POKE 555,34 + 8 
110 P0=PMBA5E + 512 

129 FOR A=PO TO PO + 128 : POKE A,0: NEHT A 

130 FOR A=PO + 60 TO P0 + 67:READ B: POKE A , B : NEHT A 
140 POKE 53256,3 

150 POKE 623,1 
160 POKE 704,108 

170 POKE 53248,PEEKC203 : GOTO 170 
180 DATA 60,126,125,153,255,36,66,125 

TOPSY-TURVY 

When you run Topsy-Turvy, your screen will be filled with strange 
writing. To straighten it out, simply press rstarTI . To mess things up 
again, press fseiect I 

10 POKE 764,255: POKE 580,1 

20 GRAPHICS 18: POKE 712,128: POKE 755,5 
30 POSITION 5,3: PRINT «6; WELCOME TO" 

40 POSITION 2,5:PRINT «6; "THE TOPSY-TURUY ,J :POSITION 
6^7:PRINT tt6; "WORLD OF": POSITION 6,5 
50 PRINT tt6;" COMPUTERS" 

60 IF PEEK£53275 3=5 THEN POKE 755,5:POKE 712,128 
70 IF PEEK £532753 =6 THEN POKE 755,1: POKE 712,55 
80 GOTO 60 


81 












TYPE-A-TUNE 


This program assigns musical note values to the keys on the top row 
of the keyboard. Press only one key at a time. 

MUSICAL VALUE 

l B 

B (or A#) 

L A 

A p (or G#) 

G t 

F#(or G p ) 

F 

i E 

E p (or D#) 

L D 

D b (or C#) 

C 

10 DXM CH0RDC37),TUNEC123 

20 GRAPHICS 8 : ? 5 ? " TYPE—A—TUNE PROGRAM" 

25 ? : ? "PRESS KEYS 1-9,0,<,> TO PRODUCE NOTES. 

27 ?: ? "RELEASE ONE KEY BEFORE PRESSING THE NEKT . " 

28 ?:? "OTHERWISE.. THERE MAY BE A DELAY. " 

30 FOR K=1 TO 37: READ A : CHORDCK)=A:NEKT K 
40 FOR H=1 TO 12: READ A:TUNECK)=A:NEKT K 
50 OPEN til,4,0, "K: " 

55 OLDCHR=—1 

60 A=PEEKC7643 : IF A=255 THEN 60 
63 IF A=OLDCHR THEN 100 
65 OLDCHR=A 

70 FOR K=1 TO 12: IF TUNECK3=A THEN SOUND 
0,CHORDC K 3,10,8:GOTO 100 
80 NEKT K 

100 I=INTCPEEKC537753/43:IF CI/23=INTC1/23 THEN 60 

110 POKE 764,255: SOUND 0,0,0,0 : OLDCHR=-l :GOTO 60 

200 DATA 243,230,2J.7,204,193,182,173,162,153,144,136, 

128,121,114,108,102,96,91,85,81,76,72,68,64,60 

210 DATA 57,53,50,47,45,42,40,37,35,33,31,29 

220 DATA 31,30,26,24,29,27,51,53,48,50,54,55 

To play "Mary Had a Little Lamb,” press the following keys: 

5,3,1, 3, 5, 5, 5 3, 3, 3 5, 8,8 5, 3, 1, 3, 5, 5, 5 5, 3, 3, 5, 3, 1 

Note: Make sure you insert three spaces between THE and NEXT in 
line 27. 


KEY 

Insert 

Clear 

0 

9 

8 

7 

6 

5 

4 

3 

2 

1 


82 





HIGHER MATH 


Your ATARI Computer is a fancy calculator. When you enter two 
numbers into the program below, the computer will tell you their 
greatest common denominator. For example, if you enter 690911 and 
11214017, you’ll soon discover that their greatest common 
denominator is 53147. 

10 ? CHR$C125 3 :? "Enter two nuhbers. Press Return after 
each entry. 11 
20 INPUT N1N2 
30 GOSUB 30 

40 ? "Their GCD is AN 

50 POKE 752^1: POSITION 10.. 10: ? "Press Start to 
continue." 

60 IF PEEK(53273306 THEN GOTO 60 
70 POKE 752^0:? CHR5C125) : GOTO 10 
80 REM ****SUBROUTINE**** 

30 AN=0 : POKE 135 ..0 : TRAP 130: M= C N1> = N2 J*N1 + C N2>N1 J*N2 
N=CM=N13*N2+CM=N2}*N1 

100 IF INTCN1JON1 OR INT CN23 0N2 THEN RETURN 
110 P=M—INT CM/N3*N:M=N:N = P 
120 IF POO THEN GOTO 110 
130 ftN=M*CPEEKCl35J=03 :RETURN 


83 








COMPUTER BLUES 


This program generates random musical notes to “write'’ some very 
interesting melodies for the programmed bass, 

1 GRAPHICS e : ? : ? " COMPUTER BLUES" : ? 

2 PTR=1 

3 THNOT—1 

5 CHORD=l 

6 PRINT "BASS TEMPO tl=FAST3 " - ! 

7 INPUT TEMPO 

8 GRAPHICS 2 + 16 : GOSUB 2099 
IB DIM BASEC 3^ 43 

20 DIM LOMC 3 3 

25 DIM LINEC16 3 

26 DIM JAMC3 ^73 

39 FOR H=1 TO 3 

40 FOR Y=1 TO 4 

50 READ A : BASECK^Y3=A 
60 NEKT Y 
70 NEKT K 

80 FOR K=1 TO 3: READ A:LOMCK3=A 
SO NEKT K 

95 FOR K=1 TO 16:READ A:LINE(K3=A SNEKT K 

96 FOR K=1 TO 3 

97 FOR Y=1 TO 7 

98 READ A : JAM(K^Y3=A : NEKT Y : NEKT K 
100 GOSUB 500 

110 T=T + 1 
115 GOSUB 200 
120 GOTO 100 

20O REM PROCESS HIGH STUFF 

205 IF RNDC0J<0.25 THEN RETURN 

210 IF RNDCO3 <0.5 THEN 250 

220 NT=NT + 1 

230 IF NT>7 THEN NT=7 

240 GOTO 260 

250 NT=NT-1 

255 IF NT<1 THEN NT=1 

260 SOUND 2^ JAMC CHORD^NT 3 ^10 ^ NT*2 

280 RETURN 

500 REM PROCESS BASE STUFF 
510 IF BASS=1 THEN 700 
520 BDUR=BDUR + 1 

530 IF BDUR< >TEMPO THEN 535 

531 BASS=1:BDUR=0 

535 SOUND 0 s LOW t CHORD 3^10^4 

540 SOUND l / BASEtCHORD / THNOT3^10 (F 4 


84 






550 RETURN 

700 SOUND 0,0,0,0 

710 SOUND 1,O,O,0 

720 BDUR=BDUR + 1 

730 IF BDUROl THEN 800 

740 BDUR=0 : BASS=0 

750 THN0T = THN0T + 1 

760 IF THN0TO5 THEN 800 

765 THN0T = 1 

770 PTR=PTR+1 

780 IF PTR=17 THEN PTR=1 

790 CHORD—LINEtPTR) 

800 RETURN 

1000 DAT A 162,144,136,144,121,108,102,108,108,96,91,96 
1O10 DATA 243,182,162 

1020 DATA 1,1,1,1,2,2,2,2,1,1,1,1,3,2,1,1 

1O30 DATA 60,50,47,42,40,33,29 

1040 DATA 60,50,45,42,40,33,29 

1050 DATA 81,68,64,57,53,45,40 

2000 PRINT «6: PRINT »6: PRINT »6 

2005 PRINT «6;" Cowputer" 

2006 PRINT »6 

2O10 PRINT »6; 11 Blues" 

2030 RETURN 


85 






UNITED STATES FLAG 


This program involves switching colors to set up the stripes. It uses 
graphics mode 7 plus 16 so that the display appears as a full screen. 
Note the correspondence of the COLOR statements with the 
SETCOLOR statements. For fun and experimentation purposes, add a 
SOUND statement and use a READ/DATA combination to add “The 
Star Spangled Banner” after line 470. 

10 REM DRAM THE UNITED STATES FLAG 

20 REM HIGH RESOLUTION 4-COLOR GRAPHICS.. NO TEHT WINDOW 
30 GRAPHICS 7 + 16 

40 REM SETCOLOR 0 CORRESPONDS TO COLOR 1 
50 SETCOLOR 0..4..4:RED = 1 

60 REM SETCOLOR 1 CORRESPONDS TO COLOR 2 

70 SETCOLOR 1.. 0.. 14 : WHITE = 2 

80 REM SETCOLOR 2 CORRESPONDS TO COLOR 3 

30 BLUE = 3 : REM DEFAULTS TO BLUE 

100 REM DRAW 13 RED & WHITE STRIPES 

110 C = RED 

120 FOR 1 = 0 TO 12 

130 COLOR C 

140 REM EACH STRIPE HAS SEVERAL HORIZONTAL LINES 

150 FOR J = 0 TO 6 

160 PLOT 0..I*7 + J 

170 DRAWTO 153 1*7 +J 

180 NEXT J 

130 REM SWITCH COLORS 

200 C = C + 1:IF C>WHITE THEN C=RED 

210 NEXT I 

300 REM DRAW BLUE RECTANGLE 

310 COLOR BLUE 

320 FOR I = 0 TO 48 

330 PLOT 0^1 

340 DRAWTO 73..I 

350 NEXT I 

360 REM DRAW 3 ROWS OF WHITE STARS 
370 COLOR WHITE 

380 K = 0 : REM START WITH ROW OF 6 STARS 
330 FOR 1=0 TO 8 
335 Y = 4 + I*5 

40O FOR J = 0 TO 4 : REM 5 STARS IN A ROW 
410 X = K + 5 + J*14:GOSUB 1000 
420 NEXT J 

430 IF K<>0 THEN K = 0:GOTO 470 


86 





440 REM ADD 6TH STAR EVERY OTHER LINE 
450 H=5+5*14 : GOSUB 1000 
460 K=7 
470 NEKT I 

500 REM IF KEY HIT THEN STOP 
510 IF PEEK£764)=255 THEN 510 

515 REM OPEN TEHT WINDOW WITHOUT CLEARING SCREEN 

520 GRAPHICS 7 + 32 

525 REM CHANGE COLORS BACK 

530 SETCOLOR 0,4^4: SETCOLOR 1,0,14 

550 STOP 

1000 REM DRAW 1 STAR CENTERED AT H,Y 
1010 PLOT H—1, Y : DRAWTO H + 1,Y 
1020 PLOT H, Y-l: PLOT H,Y+1 
1030 RETURN 


87 






IGPAY ATINLAY 


This short program converts words or sentences into pig Latin. One 
word of caution, though; don’t enter any one-letter words like A or I. 

16 DIM ASC2563 :S = 2 

26 ? "Type in a word or sentence. Please don 1 1 exceed 
three lines of text. " 

36 INPUT AS 

40 FOR X=1 TO LENC AS J 

50 IF ASCX^K)=:CHRSC32) THEN PRINT 

ASCS^X-lJ^ASCS-l^S-lJ; "AY".:" "; :5=X+2 

60 IF X=LENC AS3 THEN PRINT ASC5^X).i A$CS-1^5-1J; "AY" 

70 NEXT X 

80 ? : ? : ? "THAT'S ALL FOLKS! " 

GRAPHEEK 

Just type this one in and watch the graphics action. 

10 DIM ASC35) 

20 GRAPHICS 1 
25 TRAP 90 

30 A$ = "THIS IS A GRAPHICS DEMONSTRATION." 

40 FOR 1=1 TO 33i? tt6;A$CI,I); 

50 S=PEEKC537701 
60 SOUND O/S/10/14 
70 FOR DELAY=0 TO 100: NEXT DELAY 
80 NEXT I 

90 SOUND 0/0,0/0:END 

Note: Make sure you insert two spaces between GRAPHICS and 
DEMONSTRATION in line 30. 

ESREVER 

The title of this program is simply the word REVERSE printed in reverse. 
To print words spelled backward, just type in this short program. After 
you run it, a question mark will appear on your screen. Enter a word 
or a short sentence and let your ATARI 130XE do all the work. 

10 DIM ASC1803 

20 PRINT "Enter a word or short sentence and press 
Return," 

30 INPUT AS 

40 FOR X=LENCAS3 TO 1 STEP -I 
50 PRINT ASCX^X? ^ 

60 NEXT X 

70 PRINT : PRINT : GOTO 20 


88 






PROTECTING YOUR PROGRAM 

Ever wonder how you could protect your programs from prying eyes 
and quick fingers? A couple of programming tips can help keep 
pilferers out of your programs. 

First type in this program: 

10 FOR H=1 TO 50:POKE 710,X; NEXT X:GOTO 10 

To protect the program, add another program line to disable the 
1 Break I key. This line prevents someone from breaking into the 
program and listing it while it's running. Also, if you design a program 
that requires keyboard entry, disabling the I Break I key protects against 
“finger slip,” that dreaded mishap when your finger accidentally hits 
the i Break I key and brings your program to a screeching halt. 

Delete GOTO 10 from the colorful program and add this line: 

20 POKE 16/64:P0KE 53774,64: GOTO 10 

Now run your new program and try to stop it by pressing the 1 Break | 
key. You can’t get into it. 

To be effective, the POKE statements must be inserted in your 
program after each graphics mode command. 

Disabling the | Break 1 key has its limitations. Some smart programmer 
will figure out that he or she can break into your program and list it by 
simply pressing the [ Reset I key. To foil this culprit, add this line to your 
program: 

5 POKE 580,1 

Now when the inquisitive intruder presses I Reset I , the flashing colors 
program is purged from the computer’s memory—no program, no 
listing! The POKE statement should always be at the beginning of your 
program. 


89 



















SEA GULL OVER OCEAN 

This program combines graphics and sounds. The sounds are not 
"pure” sounds; they simulate the roar of the ocean and the gull’s cry. 
To get the symbols in line 20, use I Control I [G] , | Control | fFl . [Control | 
El, I Control I [R] . 

10 DIM BIRDSC4) 

20 BIRDS="\/—" 

30 FLAG=1:ROH=10:COL=10 

40 GRAPHICS 1: POKE 756,226 : POKE 752,1 

50 SETCOLOR 0,0,0 : SETCOLOR 1,8,14 

60 print *16; " the ocean" 

70 R=INTCRNDC0)*11> 

80 POSITION 17,17 
90 FOR T=0 TO 10 
100 SOUND 0,T,8,4 
110 FOR A=1 TO 50 : NEXT A 

120 IF RNDC0) >0.8 THEN FOR D=10 TO 5 STEP -1: SOUND 
1,0,10,INTCRNDC0)*10):NEXT D: SOUND 1,0,0,0 
130 GOSUB 200 
140 NEXT T 

150 FOR T=10 TO 0 STEP -1 

160 SOUND 0,T,8,4 

170 FOR A=1 TO 50: NEXT A 

175 IF RNDC0) >0.8 THEN FOR D=10 TO 5 STEP 

-ItSOUND 1,D,10,8: NEXT D : SOUND 1,0,0,0 

180 FOR H=1 TO 10 : NEXT H 

185 GOSUB 200 

190 NEXT T 

195 GOTO 70 

200 GOSUB 300 

210 POSITION COL,RON 

220 PRINT tt6^BIRDSCFLAG,FLAG+1) 

230 FLAG=FLAG + 2 : IF FLAG=5 THEN FLAG=1 
240 RETURN 

300 IF RND C0 ) >0.5 THEN RETURN 

310 POSITION COL,ROM 

320 PRINT »6; 11 11 

330 A=INTCRNDC0)*3)-1 

340 B=INTCRNDC0)*3>—1 

350 ROH=ROH+A 

360 IF ROH=0 THEN ROM=l 

370 IF ROH=20 THEN R0M=19 

380 COL=COL + B 

390 IF COL=0 THEN COL=l 

400 IF C0L>18 THEN C0L=18 

410 RETURN 

Note: Two spaces are required between the quotation marks in 
line 320. 90 













KINETIC ART 


Put colors in motion with a program that creates a rainbow of 
continually moving lines. 

18 REM KINETIC ART BY NEIL HARRIS 
28 GRAPHICS 10 
30 DIM AI3/50) 

35 FOR L=0 TO 3 : FOR M=0 TO 50 : ACL/M)=0 : NEXT M: NEXT L 
40 HUE=INTIRNDt1)*8+1):POKE 

704+HUE/INTtRNDtl)*8)*16+INTtRNDtl)*4+4) 

50 Xl=INTtRNDtl)*80):X2=INTtRNDtl)*80) 

:Y1=INTCRNDC1)*192):Y2=INTCRNDC1)*192) 

60 COLOR 0:PLOT At0,WHICH) ,Atl,WHICH) : DRAHTO 
At 2.. WHICH).. At 3.. WHICH! 

70 BOIINCE=BOUNCE—1: IF BOUNCE>0 THEN 90 
80 BOUNCE=INT£RND£1)*10+10):BX1=INTfRND11)*9-4) 
:BX2=INT£RNDtl)*9—4):BYI=INT£RND£1)*13—6) 

:BY2=INTCRNDCl)*13-6) 

90 CHANGE=CHANGE—1: IF CHANGE>0 THEN 110 

100 CHANGE=INTCRND£l)*10+5):HUE=INTtRND11)*8 + l):POKE 
704+HUE,INTtRNDtl)*256) 

110 COLOR HUE! PLOT XI.. Y1: DRAWTO X2/Y2 

120 At0/WHICH)=X1:At1/WHICH)=Y1:At2 ..WHICH) =X2:A 

t3/WHICH)=Y2 

130 WHICH=WHICH + 1: IF WHICH>50 THEN WHICH=0 
140 X1=X1 + BX1: IF X1<0 OR Xl>79 THEN BX1 = -BX1: GOTO 140 
150 X2=X2 + BX2 : IF X2<0 OR X2>79 THEN BX2=-BX2 : GOTO 150 
160 Y1=Y1 + BY1: IF Y1<0 OR Yl>191 THEN BY1=-BY1: GOTO 160 
170 Y2=Y2 + BY2 : IF Y2<0 OR Y2>191 THEN BY2=-BY2 : GOTO 170 
180 GOTO 60 


91 









92 








B. BASIC Reserved Words 


Note: The period is mandatory after all abbreviated keywords. 


RESERVED BRIEF SUMMARY 

WORD ABBREVIATION OF BASIC STATEMENTS 

ABS Returns the absolute (unsigned) value 

of the variable or expression. 

ADR Returns the memory address of a 

string variable. 

AND Functions as a logical operator. The 

expression is true only if both 
subexpressions joined by AND are 
true. 

ASC Returns the numeric value of a single 

string character. 

ATN Returns the arctangent of a number 

or expression in radians or degrees. 

BYE B. Exits from BASIC and returns to the 

resident operating system or console 
processor. 

CLOAD CLOA. Loads data from the program 

recorder into RAM. 

CHR$ Returns a single string byte 

equivalent to a numeric value 
between 0 and 255 in ATASCII code. 

CLOG Returns the base 10 logarithm of an 

expression. 

CLOSE CL. Closes a file at the conclusion of I/O 

operations. Functions as an I/O 
command. 

CLR Performs the opposite function of 

DIM: undimensions all strings and 
matrices. 

93 






COLOR 


C. Chooses the color register to be used 

in color graphics work. 


COM 


Performs the same function as DIM. 


CONT CON. 

COS 

CSAVE 

DATA D. 

DEG DE. 

DIM Dl. 

DOS DO. 

DRAWTO DR. 

END 

ENTER E. 


Stands for “continue." Causes a 
program to restart execution on the 
next line after being stopped by the 
I Break I key or encountering STOP. 

Returns the cosine of the variable or 
expression in degrees or radians. 

Outputs data from RAM to the 
program recorder for tape storage. 

As part of the READ-DATA 
combination, identifies the 
succeeding items (which must be 
separated by commas) as individual 
data items. 

Tells the computer to perform trigono¬ 
metric functions in degrees instead of 
radians. (The default measurement is 
in radians.) 

Reserves the specified amount of 
memory for matrix, array, and string 
variables. (All string variables, arrays, 
and matrices must be dimensioned 
with a DIM statement.) 

Stands for “Disk Operating System.” 
Causes the menu to be displayed. 

(See DOS manual.) 

Draws a straight line between a 
plotted point and a specified point. 

Stops program execution; closes files; 
turns off sounds. May be used more 
than once in a program. (CONT can 
be used to restart the program.) 

Stores data or program in 
untokenized (source) form. Functions 
as an I/O command. 

94 













EXP 


Returns e (2.7182818) raised to a 
specified power. 

FOR 

F. 

Used with NEXT to establish FOR- 
NEXT loops. Introduces the range 
that the loop variable will operate in 
during the execution of the loop. 

FRE 


Returns the amount of remaining user 
memory in bytes. 

GET 

GE. 

Used mostly with disk operations to 
input a single byte of data. 

GOSUB 

GOS. 

Branches to a subroutine beginning at 
a specified line number. 

GOTO 

G. 

Branches unconditionally to a 
specified line number. 

GRAPHICS 

GR. 

Specifies one of the 16 graphics 
modes. (GR.O can be used to clear 
the screen.) 

IF 


Causes conditional branching or the 
execution of another statement on 
the same line (only if the first 
expression is true). 

INPUT 

1 . 

Causes the computer to ask for input 
from the keyboard. Execution con- 
tinues only when the iRetuml kev is 
pressed after data have been inputted. 
Also functions as an I/O command. 

INT 


Returns the next lowest whole integer 
below a specified value. (Rounding is 
always downward, even when the 
number is negative.) 

LEN 


Returns the length of the specified 
string in bytes or characters. (One 
byte contains one character.) 

LET 

LE. 

Assigns a value to a specific variable 
name. (LET is optional in ATARI 

BASIC and can be omitted.) 


95 













LIST 


L. 

LOAD LO. 

LOCATE LOC. 


LOG 


Displays or otherwise outputs the 
program list. 

Inputs from a disk into the computer. 

Stores in a specified variable the 
value that controls a specified 
graphics point. 

Returns the natural logarithm of a 
number. 


LPRINT LP. 

NEW 


Commands the line printer to print a 
specified message. 

Erases all contents of user RAM. 


NEXT N. 


NOT 

NOTE NO. 

ON 


OPEN 0. 

OR 


PADDLE 


Causes a FOR-NEXT loop to 
terminate or continue, depending on 
the particular variables or expres¬ 
sions. (All loops are executed at least 
once.) 

Returns a 1 only if the expression is 
not true; returns a 0 if it is true. 

Used only in disk operations. 

(See Disk Operating System manual.) 

Used with GOTO or GOSUB for 
branching purposes. (Multiple 
branches to different line numbers 
are possible, depending on the value 
of the ON variable or expression.) 

Opens the specified file for input or 
output operations. 

Used as a logical operator between 
two expressions. If either one is true, 
a 1 is evaluated; if both are false, a 0 
results. 

Returns the position of the paddle 
game controller. 


96 







PEEK 

PLOT PL. 

POINT P. 

POKE POK. 

POP 

POSITION POS. 


Returns the decimal form of the 
contents of a specified memory 
location (RAM or ROM). 

Plots a single point at a specified X,Y 
location. 

Used with disk operations only. See 
Disk Operating System manual. 

Inserts the specified byte into the 
specified memory location. May be used 
only with RAM. 

Removes the loop variable from the 
GOSUB stack. Used when departure 
from the loop is made in an other- 
than-normal manner. 

Sets the cursor at a specified screen 
position. 


PRINT PR. or? 

PTRIG 

PUT PU 

RAD 

READ REA. 

REM R. 


Causes output from the computer to 
the specified output device. Functions 
as an I/O command. 

Returns the status of the trigger 
button on a game controller. 

Causes output of a single byte of data 
from the computer to the specified 
device. 

Tells the computer to give information 
in radians, rather than in degrees, for 
trigonometric functions. (The default 
measurement is radians. See DEG.) 

Reads the items in the DATA list and 
assigns them to specified variables. 

Stands for “remarks.” Does nothing 
but allows comments to be printed in 
the program list for the programmer’s 
future reference. REM statements are 
not executed. 


97 








RESTORE 

RES. 

Allows data to be read more than 
once. 

RETURN 

RET. 

Returns the computer from a sub¬ 
routine to the statement immediately 
following the one in which GOSUB 
appears. 

RND 


Returns a random number between 0 
and 1, but never 1. 

RUN 

RU. 

Executes the program; sets normal 
variables to 0; undims arrays and 
strings. 

SAVE 

S. 

Causes data and programs to be 
recorded on disk under the filespec 
provided with SAVE. Functions as an 
I/O command. 

SETCOLOR 

SE. 

Stores hue and luminance color data 
in a particular color register. 

SGN 


Returns +1 if the value is positive; 0, 
if zero; -1, if negative. 

SIN 


Returns the trigonometric sine of a 
given value in degrees or radians. 

SOUND 

SO. 

Controls register, pitch, distortion, 
and volume of a tone or note. 

SQR 


Returns the square root of a specified 
value. 

STATUS 

ST. 

Calls status routine for a specified 
device. 

STEP 


Used with FOR-NEXT. Determines the 
quantity to be skipped between suc¬ 
cessive loop variable values. 

STICK 


Returns the position of the stick game 
controller. 

STRIG 


Returns 1 if stick trigger button is not 


pressed; 0, if pressed. 









STOP STO. 

STR$ 

THEN 

TO 

TRAP T. 

USR 

VAL 

XIO X. 


Causes the program to stop but does 
not close files or turn off sounds. 

Returns a character string equal to 
the numeric value given. (For 
example, STR$(65) returns 65 as a 
string.) 

Used with IF. If the expression is 
true, the THEN statements are 
executed. If the expression is false, 
control passes to the next line. 

Used with FOR, as in “FOR X = 1 
TO 10.” Separates the loop range 
expressions. 

Takes control of the program in case 
of an INPUT error and directs 
execution to a specified line number. 

Returns the results of a machine- 
language subroutine. 

Returns the equivalent numeric value 
of a string. 

Used with disk operations (see Disk 
Operating System manual) and in 
graphics work. Functions as a 
general I/O statement. 


99 









100 







C.ATASCII Character Set 


Decimal 

Hexadecimal 

ATASCII 


European 

Code 

Code 

Character 

Keystrokes 

Character 

0 

0 


Control 

a 

1 

1 


Control A 

u 

2 

2 

□ 

Control B 

N 

3 

3 

s 

Control C 

E 

4 

4 

E 

Control D 

C 

5 

5 

0 

Control E 

6 

6 

6 

0 

Control F 

6 

7 

7 

E 

Control G 

i 

8 

8 

a 

Control FI 

£ 

9 

9 

□ 

Control 1 

I 

10 

A 

IE 

Control J 

u 

11 

B 

□ 

Control K 

a 

12 

C 


Control L 

0 

13 

D 

□ 

Control M 

u 

14 

E 

y 

Control N 

6 

15 

F 

0 

Control 0 

6 

16 

10 

0 

Control P 

0 

17 

11 

0 

Control Q 

a 


Notes: 

1. ATASCII stands for ATARI ASCII. Letters and numbers have the same 
values as those in ASCII, but some of the special characters are different. 

2. Except as shown, the characters from 128 to 255 are the reverse colors of 
1 to 127. 

3. Add 32 to the uppercase code to get the lowercase code for the same letter. 

4. To get the ATASCII code, tell the computer (direct mode) to PRINT ASC 

(“_”). Fill the blank with a letter or a character. You must use the 

quotes! 

5. The normal display keycaps are shown as white symbols on a black back¬ 
ground; the inverse keycap symbols are shown as black symbols on a white 
background. 


101 














Decimal 

Hexadecimal 

ATASCII 


Code 

Code 

Character 

Keystrokes 

18 

12 

0 

Control R 

19 

13 

ffl 

Control S 

20 

14 

0 

Control T 

21 

15 

a 

Control U 

22 

16 

E 

Control V 

23 

17 

s 

Control W 

24 

18 

0 

Control X 

25 

19 

(E 

Control Y 

26 

1A 

0 

Control Z 

27 

IB 

m 

Esc Esc 

28 

1C 


Esc Control 

29 

ID 

0 

Esc Control - 

30 

IE 

0 

Esc Control + 

31 

IF 

0 

Esc Control * 

32 

20 

□ 

Space bar 

33 

21 

m 

Shift 1 

34 

22 

□ 

Shift 2 

35 

23 

E 

Shift 3 

36 

24 

E 

Shift 4 

37 

25 

m 

Shift 5 

38 

26 

ii 

Shift 6 

39 

27 

□ 

Shift 7 

40 

28 

m 

Shift 9 

41 

29 

m 

Shift 0 

42 

2A 

i 

* 

43 

2B 

a 

+ 

44 

2C 

□ 

i 

45 

2D 

□ 

- 

46 

2E 

□ 



European 

Character 

u 

T 

e 

e 

n 

e 

o 

a 

a 

o 

A 


102 


















cin 

:od 

47 

48 

49 

50 

51 

52 

53 

54 

55 

56 

57 

58 

59 

60 

61 

62 

63 

64 

65 

66 

67 

68 

69 

70 

71 

72 

73 

74 

75 


Hexadecimal 

Code 

2F 

30 

31 

32 

33 

34 

35 

36 

37 

38 

39 
3A 
3B 
3C 
3D 
3E 
3F 

40 

41 

42 

43 

44 

45 

46 

47 

48 

49 
4A 
4B 


ATASCII 

Character 

0 

m 

a 

0 

0 

a 

L5j 

a 

s 

0 

0 

a 

m 


a 

0 

e 


B 


c 

D 


m 

a 

ED 

m 

a 

a 


Keystrokes 

/ 

0 

1 

2 

3 

4 

5 

6 

7 

8 
9 

Shift . 


> 

Shift / 

Shift 8 
A 
B 
C 
D 
E 
F 
G 
H 
\ 

J 

K 


European 

Character 


103 































Decimal 

Hexadecimal 

AT ASCII 


Code 

Code 

Character 

Keystrokes 

76 

4C 

E 


L 

77 

4D 

El 


M 

78 

4E 

M 


N 

79 

4F 

1 

3 


0 

80 

50 

1 

3 


P 

81 

51 



Q 

82 

52 

[ 

3 


R 

83 

53 

1 

3 


S 

84 

54 

1 

7] 


T 

85 

55 

1 

ul 


U 

86 

56 

1 

0 


V 

87 

57 

h 

w 

88 

58 

1 

3 

i 

X 

89 

59 

m 

Y 

90 

5A 


a 

i 

Z 

91 

5B 


E 

Shift , 

92 

5C 


E 

Shift + 

93 

5D 


a 

Shift 

94 

5E 


E 

i 

Shift * 

95 

5F 


□ 

Shift 

96 

60 


E 

i 

Control 

97 

61 


E 

i 

a 

98 

62 


b 


b 

99 

63 


E 

I 

c 

100 

64 


El 

d 

101 

65 


E 

I 

e 

102 

66 


E 

f 

103 

67 


E 

] 

g 

104 

68 


K.. 

1 1 


h 

105 

69 




i 


European 

Character 


I 


<» 

<» 

•» 

i 

« 


104 


















icim 

;ode 

106 

107 

108 

109 

110 

111 

112 

113 

114 

115 

116 

117 

118 

119 

120 

121 

122 

123 

124 

125 

126 

127 

128 

129 

130 

131 

132 

133 

134 


Hexadecimal 

ATASCII 


Code 

Character 

Keystrokes 

6A 

a 

i 

6B 

0 

k 

6C 

m 

i 

6D 

0 

m 

6 E 

0 

n 

6F 

0 

0 

70 

0 

P 

71 

a 

q 

72 

h 

T 

73 

a 

s 

74 

a 

t 

75 

0 

u 

76 

0 

V 

77 

0 

w 

78 

0 

X 

79 

0 

y 

7 A 

0 

z 

7B 


Control 

7C 

m 

m 

Shift 

Esc Control < 

7D 

or 

Esc Shift < 

7E 

a 

Esc Delete Bk Sp 

7F 

► 

Esc Tab 

80 

□ 

W\ Control . 

81 

D 

W\ Control A 

82 

n 

W\ Control B 

83 

a 

W\ Control C 

84 

a 

W\ Control D 

85 

a 

W\ Control E 

86 

□ 

W\ Control F 


European 

Character 


A 


105 













Decimal 

Code 

Hexadecimal 

Code 

ATASCII 
Character 

Keystrokes 

135 

87 

□ 

E Control G 

136 

88 

H 

E Control H 

137 

89 

B 

E Control 1 

138 

8A 

a 

E Control J 

139 

8B 

E 

E Control K 

140 

8C 

a 

E Control L 

141 

8D 

B 

E Control M 

142 

8E 

m 

E Control N 

143 

8F 

a 

E Control O 

144 

90 

□ 

E Control P 

145 

91 

B 

E Control Q 

146 

92 

B 

E Control R 

147 

93 

□ 

E Control S 

148 

94 

□ 

E Control T 

149 

95 

H 

E Control U 

150 

96 

■ 

E Control V 

151 

97 

□ 

E Control W 

152 

98 

□ 

E Control X 

153 

99 

[1 

E Control Y 

154 

9A 

D 

E Control Z 

155 

9B 

EOL 

E Return 

156 

9C 

□ 

E Esc Shift 
Delete Bk Sp 

157 

9D 

□ 

E Esc Shift > 

158 

9E 

□ 

E Esc Control 
Tab 

159 

9F 

□ 

E Esc Shift 

Tab 

160 

AO 

■ 

E Space bar 

161 

A1 

H 

E Shift 1 

162 

A2 

B 

E Shift 2 

163 

A3 

E9 

E Shift 3 


European 

Character 


106 















cimal 

:ode 

164 

165 

166 

167 

168 

169 

170 

171 

172 

173 

174 

175 

176 

177 

178 

179 

180 

181 

182 

183 

184 

185 

186 

187 

188 

189 

190 

191 

192 

193 


Hexadecimal 

Code 

ATASCII 

Character 

Keystrokes 

A4 

E3 

B Shift 4 

A5 

H 

B Shift 5 

A6 

i 

B Shift 6 

A7 

■ 

B Shift 7 

A8 

D 

B Shift 9 

A9 

O 

B Shift 0 

AA 

□ 

B * 

AB 

□ 

B + 

AC 

n 

B « 

AD 

a 

B “ 

AE 

a 

B • 

AF 

a 

B / 

BO 

a 

B 0 

B1 

D 

B 1 

B2 

a 

B 2 

B3 

m 

B 3 

B4 

□ 

B 4 

B5 

a 

B 5 

B6 

m 

B 6 

B7 

a 

B 7 

B8 

m 

B 8 

B9 

a 

B 9 

BA 

H 

B Shift: 

BB 

H 

B ; 

BC 

a 

B < 

BD 

g 

B = 

BE 

B 

B > 

BF 

B 

B Shift/ 

CO 

m 

B Shift 8 

Cl 

ta 

B A 


European 

Character 


107 











Decimal 

Code 

Hexadecimal 

Code 

ATASCII 
Character 

Keystrokes 

European 

Character 

194 

C2 

m 

E 

B 


195 

C3 

m 

E 

C 


196 

C4 

IB 

E 

D 


197 

C5 

(9 

E 

E 


198 

C6 

19 

E 

F 


199 

C7 

ES 

E 

G 


200 

C8 

m 

m 

H 


201 

C9 

9 

E 

1 


202 

CA 

m 

E 

J 


203 

CB 

IB 

E 

K 


204 

CC 

n 

E 

L 


205 

CD 

KB 

E 

M 


206 

CE 

m 

E 

N 


207 

CF 

m 

E 

0 


208 

DO 

KB 

E 

P 


209 

D1 

m 

E 

Q 


210 

D2 

□ 

E 

R 


211 

D3 

m 

E 

S 


212 

D4 

H 

E 

T 


213 

D5 

m 

E 

U 


214 

D6 

□ 

E 

V 


215 

D7 

□ 

E 

W 


216 

D8 

□ 

E 

X 


217 

D9 

D 

E 

Y 


218 

DA 

g 

E 

Z 


219 

DB 

a 

E 

Shift 


220 

DC 

D 

E 

Shift + 


221 

DD 

fl 

E 

Shift 


222 

DE 

D 

E 

Shift * 


223 

DF 

B 

E 

Shift ■ 













ecim 

Zodt 

224 

225 

226 

227 

228 

229 

230 

231 

232 

233 

234 

235 

236 

237 

238 

239 

240 

241 

242 

243 

244 

245 

246 

247 

248 

249 

250 

251 

252 


Hexadecimal 

Code 

ATASCII 

Character 

Keystrokes 

E0 

□ 

B Control 

El 

m 

B a 

E2 

h 

B b 

E3 

0 

B c 

E4 

h 

B d 

E5 

m 

B a 

E6 

□ 

B f 

E7 

□ 

B 9 

E8 

m 

B h 

E9 

H 

B i 

EA 

H 

B j 

EB 

K3 

B k 

EC 

D 

B 

ED 

□ 

B m 

EE 

m 

B n 

EF 

h 

B o 

F0 

□ 

B P 

FI 

□ 

b d 

F2 

□ 

B r 

F3 

m 

B s 

F4 


B t 

F5 

D 

B u 

F6 

D 

B v 

F7 


B w 

F8 

m 

B x 

F9 

h 

B y 

FA 

0 

B z 

FB 

□ 

B Control 

FC 

n 

B Shift = 

FD 

□ 

Esc Control 2 


European 

Character 


109 












Decimal 

Code 

254 

255 


Hexadecimal 

Code 


ATASCII 

Character 


Keystrokes 


European 

Character 


FE 

FF 


□ 

□ 


B Esc Control 
Delete Bk Sp 

W\ Esc Control > 


<» 

4 » 

<» 

<» 

<» 





110 









D. Error Messages 


ERROR 

CODE 

NUMBER ERROR CODE MESSAGE 

2 Insufficient Memory: Not enough RAM memory is 
left to store the statement or the new variable 
name, or to dimension a new string array variable. 

3 Value Error: A value expected to be a positive 
integer is negative; a value is not within a specific 
range. 

4 Too Many Variables: The maximum of 128 different 
variable names has been exceeded. 


5 String Length Error: The user attempted to store 
string variables that exceeded the dimensioned 
string length. 

6 Out of Data: The READ statement requires more 
data items than the DATA statement(s) supplied. 

7 Line Number Greater Than 32767: The line 
number reference is greater than 32767. 

8 Input Statement Error: The user attempted to input 
a nonnumeric value into a numeric variable. 

9 Array or String DIM Error: The DIM size exceeded 
5460 for numeric arrays or 32767 for strings; an 
array or string was redimensioned; reference was 
made to an undimensioned array or string. 

11 Floating Point Overflow/Underflow: The user 
attempted to divide by zero or to refer to a number 
larger than 1 x 10 98 or smaller than 1 x 10-". 

12 Line Not Found: A GOSUB, GOTO, or THEN 
referenced a nonexistent line number. 


13 No Matching FOR Statement: A NEXT was 

encountered without a previous FOR, or nested 
FOR/NEXT statements do not match properly. 
(The Error message is reported at the NEXT 
statement, not at FOR.) 
ill 










14 Line Length Error: The statement is too complex or 
too long for BASIC to handle. 

15 GOSUB or FOR Line Deleted: A RETURN or NEXT 
statement was encountered, but the corresponding 
GOSUB or FOR has been deleted since the last 
RUN command. 

16 RETURN Error: A RETURN was encountered 
without a matching GOSUB. 

17 Syntax Error: The computer encountered a line with 
improper syntax. 

18 Invalid String Character: The string in the VAL 

statement is not a numeric string. 

Note: The following errors are INPUT/OUTPUT (I/O) errors that result 

during the use of disk drives, printers, or other accessory devices. 

Further information is provided with the auxiliary hardware. 

19 LOAD Program Too Long: Insufficient memory 
remains to complete LOAD. 

20 Device Number Error: The device number is larger 
than 7 or equal to 0. 

21 LOAD File Error: The user attempted to load a non¬ 
load file, not a BASIC tokenized file. Tokenized files 
are created with the SAVE command. 

128 Break Abort: The user hit the I Break I key during an 
I/O operation. 

129 IOCB 1 Already Open: The Input/Output Control 
Block is already open. 

130 Nonexistent Device: The user tried to access an 
undefined device (i.e., a device not in the handler 
table). 

131 IOCB 1 Write-Only Error: A READ command has 
been sent to a write-only device (printer). 

132 Invalid Command: The command is invalid for this 
device. 








133 Device or File Not Open: No OPEN command has 
been specified for the device. 

134 Bad IOCB 1 Number: The device number is illegal. 

135 IOCB 1 Read-Only Error: A WRITE command has 
been sent to a read-only device. 

136 EOF: The computer has reached the end of the file. 

137 Truncated Record: This error typically occurs when 
the record being read is larger than the maximum 
record size specified in the call to CIO. (BASIC’s 
maximum record size is 119 bytes.) 

138 Device Time-out: The device doesn’t respond. 

139 Device NAK: Problems are located at the serial 
port or in the peripheral. 

140 Serial Bus Input Framing Error: Information was 
lost from the peripheral to the computer. 

141 Cursor Out of Range: The cursor is out of range 
for a particular mode. 

142 Serial Bus Data Frame Overrun: Information was 
lost from the peripheral to the computer. 

143 Serial Bus Data Frame Checksum Error: 

Information was lost from the peripheral to the 
computer. 

144 Device Done Error: The user attempted to write on 
a write-protected diskette. 

145 Read After Write Compare Error: The user tried to 
open the Screen Editor with an illegal graphics 
mode number. 

146 Function Not Implemented: The function was not 
implemented in the handler. 

147 Insufficient RAM: Not enough RAM memory is left 
for operating the selected graphics mode. 

160 Drive Number Error: The user specified the wrong 

drive number. 


113 











Q. I just tried the computer’s built-in ATARI BASIC. I typed in a 
program, but it won’t run. Why not? 

A. Make sure you pressed I Return I after each program statement 
before typing RUN. When you press | Return | , you are telling the 
computer that you are entering information. 

Another common mistake is to confuse zeros and capital letter O’ 
Though they look similar, the computer treats them differently. 











F. Resources 


ATARI Computer users don’t have to work or play in isolation. Most of 
the problems that you might encounter have already been worked out 
by others. Much of this experience is documented, so plenty of support 
is available. The resources listed here are a few of the many aids that 
can guide you into new, rewarding directions in personal computing. 
You can obtain the resources by visiting bookstores and ATARI 
Computer retailers or by writing to the addresses provided below. 

USERS GROUPS 

You can share information with other ATARI Computer owners by 
joining an ATARI users group. Users groups usually have monthly 
meetings and publish a newsletter. Whether you need help in 
programming one of several computer languages, advice about 
purchasing software, or news about the latest products for your ATARI 
130XE, you can find it and more from your local users group. To get 
the address of the group nearest you or to find out how to start your 
own group, write ATARI Customer Relations, P.O. Box 61657, 
Sunnyvale, CA 94088. 

BOOKS 

ATARI BASIC Reference Manual. Part # C015307. Available from 
ATARI Customer Relations, P.O. Box 61657, Sunnyvale, CA 94088. 
Cost: $10.95 plus $2.50 for shipping. California residents add 6.5 per¬ 
cent tax. This manual is the most complete reference on ATARI 
BASIC. It features a complete description of every command and func¬ 
tion and gives examples. 

Technical Reference Notes. Part # C01655. Available from ATARI 
Customer Relations, P.O. Box 61657, Sunnyvale, CA 94088. Cost: 
$29.95 plus $2.50 for shipping. California residents add 6.5 percent 
tax. This manual is a technical reference volume for the advanced pro¬ 
grammer and the software developer. 

Inside ATARI BASIC: A Fast, Fun, and Friendly Approach by Bill Carris. 
Reston Publishing Co., 11480 Sunset Hill Road, Reston, VA 22090. This 
excellent book for beginners picks up where the ATARI 130XE Owner’s 
Manual leaves off. 











Your ATARI Computer by Lon Poole, Martin McNift, and Steven Cooke. 
Osborne/McGraw-Hill, 630 Bancroft Way, Berkeley, CA 94710. This 
general reference has a major emphasis on intermediate-to 
advanced-level programming in ATARI BASIC. 

Dr. Wacko’s Miracle Guide to Designing and Programming Your Own 
Arcade Games by David Heller, Addison-Wesley, Reading, MA 01867. 
This step-by-step tutorial for writing arcade-style games in ATARI 
BASIC is entertaining and educational. 

MAGAZINE 

ATARI EXPLORER. Every issue of the ATARI EXPLORER is designed to 
help you get more out of your ATARI Computer. Subscribe immediately 
and save 50 cents off the cover price—6 issues for $15.00. Or save 
25 percent by subscribing for 18 issues for $39.95. Send a check or a 
money order to ATARI EXPLORER, P.O. Box 3427, Dept. X, Sunnyvale, 
CA 94088-3427. 

CUSTOMER RELATIONS 

For questions or problems regarding ATARI products, write to ATARI 
Customer Relations, P.O. Box 61657, Sunnyvale, CA 94088 or call 
(408)745-4851. 








G. ATARI 130XE Specifications 


Processor: 

6502C Microprocessor, clock speed 1.79 MHz 

Custom Chips: 

GTIA chip—graphics display 

POKEY chip—sound generator and control 

ANTIC chip—screen and input/output ports 
FREDDY chip—memory system control 

Memory: 

131,072 bytes of RAM 

24,576 bytes of ROM (operating system plus ATARI 
BASIC programming language) 

Display: 

11 graphics modes 

256 colors 

320 x 192, highest graphics resolution 

40 columns x 24 lines text display 

5 text modes 

Sound: 

4 independent sound voices 

3 1 12 octave range 

Keyboard: 

Full-stroke design 

62 keys, including Help key and 4 special 
function keys 

International character set 

29 graphics keys 

Programming 

Features: 

Built-in ATARI BASIC programming language 
Software compatibility with all ATARI 65XE and 
800XL Computers 

RAM disk storage with ATARI DOS 2.5 

Input/Output: 

Software cartridge slot 

TV output 

Monitor output 

2 controller ports 

Serial I/O connector port 

Enhanced Cartridge Interface 

Power Supply: 

1 Amp at 5 Volts DC 






o 

4 » 

4 » 

<» 

4 » 

<» 

<1 

» 

« 


120 







H. Accessing the Full RAM 
Potential of the 130XE 



The 130XE contains 131,072 bytes of Random Access Memory (RAM): 
twice as much memory as the ATARI 65XE or the 800XL Computer. 

The extra 65,536 bytes of RAM is transparent to the user in most 
instances. Software programs may use the extra memory to store 
larger databases. And if you use an ATARI 1050 Disk Drive with 
ATARI DOS 2.5, you can use the extra memory as a RAMDISK—a 
very fast disk drive. (For more information on the 130XE and the DOS 
2.5 RAMDISK, see the DOS 2.5: ATARI 1050 Disk Drive Owner’s 
Manual.) 

However, you can access and use the extra 65,536 bytes of RAM with 
ATARI BASIC through a “bank switching” method. The two processor 
chips inside the 130XE—the 6502 central processor and the ANTIC 
video processor—were designed to access only 65,536 bytes of RAM. 
When the bank switching method is used, the computer is coerced 
into using more memory. Bank switching turns off one 16K section of 
RAM and uses some of another section in its place. In the 130XE, the 
second bank of memory is located from memory location 16384 to 
32767 in the memory map (in hexadecimal, the numbers $4000 to 
$7FFF). By changing the bank switch, the computer can select which 
bank of memory will occupy that 16K area. 

The bank switch is located in memory location 54017. This location is 
used as the port B address of the 6520 Peripheral Interface Adapter 
chip, which controls the computer’s input and output. Half of this 
memory location was used by the computer previously. 

Bits 4 and 5 select which of the computer’s processors can access 
the extra bank. Normally the bits are set to a 1. (Bit 4 enables the CPU 
banking and Bit 5 enables the Video banking.) By changing one bit to a 
0, the 6502 processor gains access to the extra RAM, and the other 
bit gives access to the ANTIC video chip. Changing both bits lets both 
processors use the extra memory. 

Bits 2 and 3 control which section of the extra memory is used. There 
are four possible combinations of the two bits, and four different 16K 
memory sections from which to choose. 








Normally, memory location 54017 contains a 193. By using the BASIC 
language POKE command you can modify this memory location to 
switch the extra RAM. For example, POKE 54017, 225 selects the first 
section of extra RAM and makes that section available to the 6502 
chip (but not to the ANTIC video chip). 

The formula for selecting a bank of memory in the 130XE is: 

POKE 54017,. 193 + 4*fiDDBESS + 16*MODE 


TABLE OF VALUES 


ADDRESS SECTION OF MEMORY 


0 0 to 16383 

1 16384 to 32767 

2 32768 to 49151 

3 49152 to 65535 


MODE 

0 

1 

2 

3 


6502 ACCESS 

Extra 

Normal 

Extra 

Normal 


ANTIC ACCESS 

Extra 

Extra 

Normal 

Normal 




MEMORY LOCATION 54017 


Bit #: 

7 

6 

5 

4 

3 

2 

1 

0 

Value: 

128 

64 

32 

16 

8 

4 

2 

1 

(If set) 

1 

1 

? 

? 

? 

? 

X 

1 




Video 

Bank 

CPU 

Bank 

Bank 

MSB 

Bank 

LSB 




Enable Enable 
(VBE) (CBE) 


Bits 0, 6, 7, 1 should always be set. 


If VBE or CBE is set, corresponding accessing is to normal. If 0, any 
access to address $4000-$7FFF is to the extra set by value of bank 
bits. 


122 















I.Connector Pinout 
Specifications 


SERIAL I/O (PERIPHERAL) PORT 



1. Clock Input 

2. Clock Output 

3. Data Input 

4. Ground 

5. Data Output 

6. Ground 

7. Command 


8. Motor Control 

9. Proceed 

10. + 5/Ready 

11. Audio Input 

12. +12V 

13. Interrupt 


CARTRIDGE SLOT 

ABCDEFHJKLMNPRS 


12 3 4 

5 6 7 

1. S4 

A. RD4 

2. A3 

B. GND 

3. A2 

C. A4 

4. A1 

D. A5 

5. AO 

E. A6 

6. D4 

F. A7 

7. D5 

H. A8 

8. D2 

J. A9 

9. D1 

K. A12 

10. DO 

L. D3 

11. D6 

M. D7 

12. S5 

N. All 

13. +5V 

P. A10 

14. RD5 

R. R/W 

15. CCTL 

S. B02 

123 


















ENHANCED CARTRIDGE INTERFACE (ECI) 


A B C D E F H 


1 2 3 4 5 

6 7 

A. Reserved 

1. EXSEL 

B. IRQ 

2. RST 

C. HALT 

3. D1XX 

D. A13 

4. MPD 

E. A14 

5. Audio 

F. A15 

6. REF 

H. GND 

7. + 5V 


MONITOR JACK 



1. Composite Luminance 

2. Ground 

3. Audio Output 

4. Composite Video 

5. Composite Chroma 


124 



















POWER ADAPTER PLUG 



1. +5V 

2. Shield 

3. Ground 

4. +5V 

5. Ground 

6. +5V 

7. Ground 


CONTROLLER PORT 



1. (Joystick) Forward Input 

2. (Joystick) Back Input 

3. (Joystick) Left Input 

4. (Joystick) Right Input 

5. B Potentiometer Input 

6. Trigger Input 

7. +5V 

8. Ground 

9. A Potentiometer Input 


125 
















126 











127 










i 

< 


128 











A 

addition function, 48 
alphanumeric variables, 45 
arrow keys, 16, 31, 47, 48, 49 
ATARI BASIC (see BASIC) 
Audio-Visual Test, 10 
auto repeat, 29 

B 

BASIC 

built-in programming 
language, 21-22, 23 
disabling the language, 12, 21 
bent arrow, 40 
blank lines, 32 
in programs, 38 
blank spaces, 31-32 
Break key, 11, 14, 34, 41, 66, 72 
bugs, 57 
BYE, 9, 12, 21 
byte, 42-43 

C 

Caps key, 15, 17, 29-30, 31 
caret, 48 

caring for your computer, 8 
cartridges 

loading, 11-12, 24 
software, 23 
Clear key, 31,40 

clearing the computer’s memory, 35 
clearing the screen, 31,40 
colon, 42 
COLOR, 73, 74-75 
color registers, 69 

changing colors in, 71, 73, 74-75 
designating, 73, 75 
colors, 68-69 
comma 

in numbers, 47 

with PRINT statements, 41-42 
commands 
COLOR, 73, 74-75 
consolidating on one line, 42, 62 
DIM, 43, 44, 45, 46 
DRAWTO, 73-74 
END, 56, 65, 66 
FOR-NEXT, 57-63, 66, 68 
FRE, 42-43 
GOSUB-RETURN, 68 
GOTO, 41,46, 55, 56, 66, 72 
IF-THEN, 52, 55-57 


INPUT, 43, 44, 53, 56 
INT, 51 
LIST, 35, 36 
NEW, 35 
PLOT, 73 
POKE, 19 

PRINT, 37, 38, 39, 40, 41, 42, 43, 
44, 71, 72 

PRINT #6;, 71, 72, 73 
READ-DATA, 68 
REM, 46 
hND, 50-52 
RUN, 36 

SETCOLOR, 69, 71, 72, 73, 74, 75 
SOUND, 65, 66 
STEP, 59-60 
TRAP, 56, 62, 68 
compatibility, 23 
Control key, 13, 15 
for graphic symbols, 17, 30-31 
for international characters, 19 
with arrow keys, 16, 31 
with Caps key, 16, 17, 31 
with Clear key, 31,40 
with Delete Back Space key, 16, 32 
with Insert key, 16, 31 
with Tab key, 33 
with 1 key, 15, 40 
with 2 key, 15 
with 3 key, 15 
counting loop, 57-63 
cursor control, 31 

D 

DATA (see READ) 
default color, 69, 71 73, 75 
default luminance, 70 
delay loop, 61-63 

Delete Back Space key, 14, 16, 32 
deleting 
lines, 32 

program lines, 38 
spaces, 32 

DIM (dimensioning), 43, 44, 45, 46 

disk drive, 23, 24, 25 

Disk Operating System, 12, 21 

display screen, 25 

distortion, 65-66 

division sign, 49 

Down Arrow key, 16, 31 

DRAWTO, 73-74 

dummy variable, 51 


129 









E 

END, 56, 65, 66 

Enhanced Cartridge Interface (ECl), 2 
erase 

computer’s memory, 35 
program lines, 38 
screen, 31 

spaces and lines, 32 
Error message, 29, 35, 37-38, 44 , 46 , 
56, 68 

Escape key, 14, 34, 40 
expansion (see ECl) 
exponent, 47-48 

F 

FOR, 58 

FOR-NEXT, 57-63 
nested FOR-NEXT loops, 62 
with SOUND, 66, 68 
FRE, 42-43 
frequency, 65 

G 

garbage error, 37 
GOSUB-RETURN, 68 
GOTO, 41, 46, 55, 56 
to maintain graphics screen 
display, 72 
with SOUND, 66 
graphic symbols, 17, 30-31, 40 
graphics capabilities, 68-76 
graphics modes, 68 
mode 0, 69, 72 
mode 1, 70-72, 73 
mode 2, 70-72, 73 
mode 3, 73-75 
mode 5, 75-76 
mode 7, 75-76 

H 

Help key, 9, 11, 14, 34 

I 

IF-THEN, 52, 55-57 
increments in counting loops, 59-60 
infinite loops, 41, 50, 55, 56 
INPUT, 43, 44, 53, 56 
inserting 
blank lines, 32 
blank program lines, 38 


blank spaces, 31-32 
program lines, 36 
Insert key, 15, 16, 31, 32 
installation of your computer, 5-8 
instruction line 
limit, 29, 39 
numbering, 35, 36 
INT, 51 

international characters, 19 
Inverse Video, 33, 40 
to change colors in graphics 
modes, 71, 73 
to test keyboard, 11 

J 

joystick, 26 

K 

Keyboard Test, 11 
keys, descriptions of, 13-16 

L 

Left Arrow key, 16, 31, 48 

line breaks, 39 

line numbering, 35, 36 

LIST, 35, 36 

logical line, 39 

loop 

counting, 57-63 
delay, 61-63 

FOR-NEXT, 57-63, 66, 68 
GOTO, 41,46, 55, 56, 66, 72 
infinite, 41, 50, 55, 56 
lowercase, 29-30 
to change colors in graphics 
modes, 71, 73 
luminance, 69, 70 

M 

math functions 
addition, 48 
division, 49 
multiplication, 49 
order of execution, 49-50 
subtraction, 48 
math programs, 53 
memory, 9-10, 23, 35, 36, 42-43 
Memory Test, 9-10, 11 
minus sign, 47, 48 
modem, 26 


130 







monitor, 25 
multiplication sign, 49 
musical notes, 67-68 

N 

nested FOR-NEXT loops, 62 
NEW, 35 
NEXT, 58 
(see FOR-NEXT) 
numbers, 47 

numeric variables, 45, 52, 55, 58 

O 

Operating System, 23 

Option key, 9, 12, 14, 21, 34 

order of mathematical functions, 49,-50 

P 

parentheses 

for order of mathematical 
functions, 49-50 
with RND, 51 

peripherals, 23, 24, 25, 26 

pitch, 65, 67 

pixel, 73 

PLOT, 73 

plus sign, 48 

POKE, 19 

PRINT, 37 

abbreviation for (?), 39 
in graphics modes, 71, 72 
to clear screen, 40 
to create blank lines, 38 
two statements on one line, 42-43 
with colon, 42 
with comma, 41-42 
with graphic symbols, 40 
with semicolon, 42 
with string variables, 44 
PRINT #6;, 71, 72, 73 
printer, 26 

program recorder, 23, 24, 26 

Q 

question mark, 44 
abbreviation for PRINT, 39 
Question Mark key, 49 
quotation marks 
to clear screen, 40 
with PRINT, 37, 40 


R 

RAM, 9, 10, 36, 42, 43 
random numbers, 50-52 
READ-DATA, 68 
register 

color, 69, 71, 73, 74, 75 
sound, 65 
REM, 46 

Reset key, 9, 11, 14, 34, 72 
RETURN (see GOSUB) 

Return key, 15, 35 

Right Arrow key, 16, 31, 48, 49 

RND, 50-52 

ROM, 9, 10, 23 

RUN, 36 

S 

scientific notation, 47-48 
screen display 
format, 39 

maintaining a graphics display, 72 
stopping the LIST display, 40 
Select key, 9, 14, 34 
Self Test, 9-11 
semicolon, 42, 44 
SETCOLOR, 69, 71, 72, 73, 74-75 
Shift key, 13, 17, 30 
with Caps key, 17 
with Clear key, 31, 40 
with Delete Back Space key, 17, 32 
with Insert key, 17, 32 
with Right Arrow key, 48 
with Tab key, 33 
software 

audiocassettes, 23, 24 
built-in, 23 

cartridges, 11-12, 23, 24 
commercial, 23 
compatibility, 23 
diskettes, 23, 24 
storing, 24, 25, 26 
user-written, 21, 23-24 
SOUND, 65-66 
sound capabilities, 65-68 
Start key, 9, 14, 34 
starting point in counting loops, 59 
STEP, 59-60 

stopping point in counting loops, 59 
stopping the screen display, 40 
storing software, 24, 25, 26 
string variables, 43, 44, 45, 55 


131 











subroutine, 68 
subtraction function, 48 

T 

Tab key, 33 
clear tabs, 33 
set tabs, 33 
test programs, 9-11 
text mode, 69, 70 
text window, 70, 72 
THEN (see IF-THEN) 

TRAP, 56, 62, 68 

u 

Up Arrow key, 16, 31,47, 48 
uppercase, 29-30 

to change colors in graphics 
modes, 71, 73 


V 

variables, 43 
dummy, 51 

in SOUND commands, 66-67, 68 
numeric, 45, 52, 55, 58 
string, 43, 44, 45, 55 
voice, 65 

volume, 65, 66, 67 







TRAVEL BEYOND THE LEADING EDGE OF COMPUTING 


Subscribe NOW to the ATARI® EXPLORER™ 
and save 500 off the cover price. 

Congratulations. You’ve just purchased the best personal computer on the 
market at the very best price. Now what are you going to do with it? Program? 
Write papers? Manage data? Play games? Maybe all of the above? 

You’ll want to dig into the latest news and information about your equip¬ 
ment, explore new ways to use your system, and discover how to expand it. 

Naturally, the best place to get information is from the source. That’s us. 
Atari Explorer magazine. 

Every issue is filled with educational articles, reviews, tutorials, and tips to 
help you and your family get the most from your computer. The Atari Explorer 
is an adventure into the world of computers for business, education, and 
entertainment. 

You can learn programming techniques for beginners and experts. Read in- 
depth reviews of the hottest new hardware and software. Get inside tips and 
strategies for winning your favorite video games. We’ll even teach you how to 
make your own arcade games with tutorials from our own game-designing 
experts. 

The Explorer features a section of do-it-yourself games and programs for 
parent-child interaction. You’ll also find practical articles on the adult world of 
money-management, business, and home applications to help you with every¬ 
day life. 

And it doesn’t just cover the serious stuff. We also feature the human side 
of computing—real people using their computers for some very interesting 
projects. 

The Explorer will intrigue, excite, and even pique your curiosity with world¬ 
wide coverage of Atari computing. So drop in and take a look around. You’ll 
like what you read. 


■ DETACH AND MAIL TODAY — 

YES, enter my subscription to the ATARI EXPLORER: 

□ 6issues. .$15.00* □ 18issues...$39.95* 

SAVE 25% 

□ Payment Enclosed □ Visa □ MasterCard 

Name_ 

Address_ 

City_ 

State _Zip _ 

Acct. No. Expiration Date_ 

1 11)1 1J..I I I I I I I I □ 

Signature_ 

*This rate limited to USA and its Possessions. Canadian subscriptions, add $5 for postage 
and handling. Overseas add $1 0.00/16issues; $30.00/18 issues. Payments due in US funds. 

MC01 
































<1 

41 

41 

(I 

41 

41 

41 

41 


41 

41 

41 

41 

II 


41 

41 


NO POSTAGE 
NECESSARY 
IF MAILED 
IN THE 

UNITED STATES 


BUSINESS REPLY CARD 

FIRST CLASS PERMIT NO. 7283 SUNNYVALE, CA 


POSTAGE WILL BE PAID BY ADDRESSEE 


ATARI EXPLORER 
P.O. BOX 3427 

SUNNYVALE, CA 94088-9990 


41 

41 


41 

41 

41 

41 

41 

41 

4» 


11 1 1 111 1 11 111 111 1 m 1 1 In li li I ii 1 1 1 11 1 1 1 11 11 1111 1 1 il I 


41 

4» 
























AATARI' 


c 1985 Atari Corp. All Rights Reserved. 
Printed in Taiwan 


C025951-001 REV. A 
K. 1.5.1985